Created
August 30, 2015 18:47
-
-
Save bueckl/e75e050d29534db00526 to your computer and use it in GitHub Desktop.
#SilverStripe - Using an action to render a SiteTree object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function show(SS_HTTPRequest $request) { | |
$page = DataObject::get_by_id('SiteTree', $this->URLParams['ID'] ); | |
if(!$page) { | |
return $this->httpError(404,'That page could not be found'); | |
} | |
$controller = new ObjektPage_Controller($page); | |
$controller->init(); | |
return $controller->getViewer('index')->process($controller); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment