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.
<?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
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?

Kurtopsy
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi Kurtopsy,

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...
Kurtopsy replied on at Permalink Reply
Kurtopsy
Hi MrKDilkington,

Thanks, that's what I followed to get this far. I feel really stupid though. I ended up finding out that my pages were pending approval. I approved them and the classes showed up.