Separate 'quick menu'
Permalink
I have a site with a sidebar menu that is basically a 'Quickmenu' for end users to navigate to more important or useful pages of the site. I created an AutoNav template for this menu that pulls pages in if they're attribute 'Quickmenu' is checked.
The issue I've run into is when a quicklink needs to be added, but is a child of a parent page. Here is my view.php file for this menu:
It's a little different than the default header_menu.php file that has callouts to child pages, but it continues to add <ul><li> classes to each additional level and I'm not entirely sure how to customize it to make child pages show up in my quicklink nav.
Any help would be greatly appreciated! Thanks!
The issue I've run into is when a quicklink needs to be added, but is a child of a parent page. Here is my view.php file for this menu:
<?php defined('C5_EXECUTE') or die("Access Denied."); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); echo("<ul class=\"quicklink\">"); $nh = Loader::helper('navigation'); $isFirst = true; foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); if ($_c->getCollectionAttributeValue('include_quicklink')) { $target = $ni->getTarget(); if ($target != '') { $target = 'target="' . $target . '"'; } if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) {
Viewing 15 lines of 44 lines. View entire code block.
It's a little different than the default header_menu.php file that has callouts to child pages, but it continues to add <ul><li> classes to each additional level and I'm not entirely sure how to customize it to make child pages show up in my quicklink nav.
Any help would be greatly appreciated! Thanks!
Are you referring to using the view.php file within the AutoNav root folder?
Yes
Due to this bug, I recommend you actually use this as a starting point:
http://www.concrete5.org/marketplace/addons/autonav-exclude-subpage...
(which I created specifically to fix that bug).
I think if you just add this code...
...above this line (should be around line #33):
...that should do the trick.
http://www.concrete5.org/marketplace/addons/autonav-exclude-subpage...
(which I created specifically to fix that bug).
I think if you just add this code...
if (!$_c->getCollectionAttributeValue('include_quicklink')) { continue; }
...above this line (should be around line #33):
$target = $ni->getTarget();
...that should do the trick.
Nice, has this been submitted to the core yet?
No, I didn't think about that. My assumption was that there are uses for showing sub-pages of excluded pages so to completely disable that would break some peoples' existing sites. But it would be nice if it was an option. I'll add it to my exceedingly long todo list :)
This was created specifically for footer navs fyi.
http://www.concrete5.org/marketplace/addons/quick-links/...
ChadStrat
http://www.concrete5.org/marketplace/addons/quick-links/...
ChadStrat
Unfortunately, there is a bug which makes pages which are nested show up in the wrong place if their parents are hidden (IE: Don't have the quick menu attribute). You'll have to figure out how to correctly handle this in your view.