li classes with autonav
Permalink
I'm using this custom template with the 5.7 autonav to create li classes with an attribute nav_item_class.
This works great, but the problem is it only works on 2 sub menu levels. I need it to go down 3 sub menu levels. Any ideas?
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <?php View::getInstance()->requireAsset('javascript', 'jquery'); $navItems = $controller->getNavItems(); foreach ($navItems as $ni) { $classes = array(); if ($ni->isCurrent) { //class for the page currently being viewed $classes[] = 'nav-selected'; } if ($ni->inPath) { //class for parent items of the page currently being viewed $classes[] = 'nav-path-selected'; } if ($ni->hasSubmenu) { //class for items that have dropdown sub-menus
Viewing 15 lines of 38 lines. View entire code block.
I recommend looking at the Auto-Nav block view.php to see how the displayed navigation is created. You can use it as an example to customize your template.
Also, at the top of view.php there is a list of useful $navItem properties.
https://github.com/concrete5/concrete5/blob/develop/web/concrete/blo...