How do you create a sub-menu that shows just the parent, not the whole top level?
PermalinkStill getting my head around autonav but am having trouble embedding a couple of sidebar menus in my templates.
Sub-menu one:
A menu that shows the parent first (highlighted) then all the pages under the parent at level 1.
Sub-menu two:
A menu that only shows the parent (highlighted).
I have this in my template:
<ul class="s-nav"> <?php $autonav = BlockType::getByHandle('autonav'); $autonav->controller->orderBy = 'display_asc'; $autonav->render('templates/sub_nav'); ?> </ul>
And this in my sub_nav.php template:
<?php defined('C5_EXECUTE') or die("Access Denied."); $bt->controller->displayPages = 'above'; $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $nh = Loader::helper('navigation'); $isFirst = true; foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); if (!$_c->getCollectionAttributeValue('exclude_nav')) { $target = $ni->getTarget(); if ($target != '') { $target = 'target="' . $target . '"'; } if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) {
I've played around with the various 'top' 'above' settings but they both seem to display the entire top level.
Should I be using a non-autonav call to grab the parent page, then using autonav to display the pages at the current level maybe?
New to c5 so sorry if this easy.
Cheers
ben

For my own reference (incase I forget later on) I put this extra call above the autonav call in the page template.
Is there way to create a flexible menu that could be used on both parent pages as well as child pages?