Always display parent 1 level down from home in atonav template
Permalink
Hi There,
I'm trying to create a nested subnav that always displays the uppermost parent, 1 level down from the home page.
I've modified the built-in template and can display the parent but am looking for a way to travel up the tree to discover the ultimate parent - if that makes sense?
Here is the start of my template with the code to display the parent commented in:
BTW, I don't know much php and have got this far by cobbling together stuff I've found on the forums.
Any help would be much appreciated.
Cheers
Ben
I'm trying to create a nested subnav that always displays the uppermost parent, 1 level down from the home page.
I've modified the built-in template and can display the parent but am looking for a way to travel up the tree to discover the ultimate parent - if that makes sense?
Here is the start of my template with the code to display the parent commented in:
<!-- sub navigation --> <ul class="s-nav"> <?php defined('C5_EXECUTE') or die("Access Denied."); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $containsPages = false; $nh = Loader::helper('navigation'); // start always display parent $title = $c->getCollectionName(); $parentPageId = $c->getCollectionParentID(); if ($parentPageId > 0) { $parentPage = Page::getById($parentPageId); $title = $parentPage->getCollectionName(); $url = View::URL($parentPage->getCollectionPath()); }
Viewing 15 lines of 20 lines. View entire code block.
BTW, I don't know much php and have got this far by cobbling together stuff I've found on the forums.
Any help would be much appreciated.
Cheers
Ben