This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi, Please I need help. I have a static page which has children pages and grandchildren page
- Top level page -- Children page --- Grandchildren page How I get slug and title of Top level page If I'm on Children page or Grandchildren page Thanks for information.
Last updated
Hi, Thank for reply. But It still doesn't work as it should. If I on url /samosprava/mestsky-urad return value "samosprava" but if url is /samosprava/mestsky-urad/vedenie-mesta than return value "samosprava-mestsky-urad". I want it to always show toplevel page ("samosprava") My php code in phpblock in layout:
$theme = Cms\Classes\Theme::getEditTheme();
$pageList = new RainLab\Pages\Classes\PageList($theme);
$page = $this->page['apiBag']['staticPage'];
$allPages = $pageList->listPages();
$pageParent = $pageList->getPageParent($page);
Last updated
You need to check if the parent page has a parent... if not, then you know you have the top-level page.
Hi. Sorry but I'm not a beckend developer. I need only always top-level page. If I on /samosprava/mestsky-urad/vedenie-mesta than I need get "samosprava" from variable.
1-6 of 6