Display the content of parent page in SilverStripe -
i have simple tree structure in silverstripe.
parentpage , childpage.
on parentpage display list of childpages. don't want make accessible url:
/parent-page/child-page
i want allow
/parent-page
that's why did redirect in childpage index action parentpage:
class childpage_controller extends page_controller { public function index() { $this->redirect('/parent-page/'); } } it works on frontend. in cms after click chidpage in tree, redirects me editing parentpage. (not frontend url admin/pages/edit/show/parentpageid ). happen in split or preview mode.
can advice how prevent it? or there other option? thanks!
in init function can check if user has permission view cms , if page has stage variable set:
class childpage_controller extends page_controller { public function init() { parent::init(); if (!($this->getrequest()->getvar('stage') && permission::check('view_cms'))) { return $this->redirect($this->parent()->link(), 301); } } } this way normal user redirected , cms user isn't viewing page ?stage=... set redirected. preview / split panes set stage variable page never redirected when viewed in preview / split pane.
Comments
Post a Comment