Skip to content

Instantly share code, notes, and snippets.

@bueckl
Created August 30, 2015 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bueckl/e75e050d29534db00526 to your computer and use it in GitHub Desktop.
Save bueckl/e75e050d29534db00526 to your computer and use it in GitHub Desktop.
#SilverStripe - Using an action to render a SiteTree object
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