Check parent page ID
Permalink
Hello,
I am trying to include a different header.php file if the page resides in a certain section of the site. For example…
if parent page id = about {
$this->inc('elements/header_about.php');
} else {
$this->inc('elements/header.php');
}
Does anyone have any clues as to how I would go about doing this?
Thanks for any direction you can give.
I am trying to include a different header.php file if the page resides in a certain section of the site. For example…
if parent page id = about {
$this->inc('elements/header_about.php');
} else {
$this->inc('elements/header.php');
}
Does anyone have any clues as to how I would go about doing this?
Thanks for any direction you can give.
I am currently using the following code to apply the top-level parent ID to the body of each page. I just can't figure how to apply a conditional function based on what it returns.
You should be able to do something like this
$c = Page::getCurrentPage(); $parentPageID = $c->getCollectionParentID(); switch($parentPageID){ case 1: //do homepage stuff break; default: //do default stuff }