Autonav levels not working as expected

Permalink
If I hardcode in the autonav with a template, it shows all levels, even if I choose custom with one level for the subpage levels. Also, I've noticed that $ni->level is not working in the template itself. particularly if I try something like:

if ($ni->hasSubmenu && $ni->level == 1) {
    echo '<li class="item-has-children ' . $ni->classes . '">'; //opens a nav item
    echo '<a href="' . $ni->url . '" target="' . $ni->target . '" class="' . $ni->classes . '">' . $ni->name . '</a>';
    echo '<ul class="sub-menu">'; //opens a dropdown sub-menu
  }


Actually it seems that the system is not accepting "&&" in the autonav template at all.
Am I checking this wrong?

justrj
 
Dutchwave replied on at Permalink Reply
Dutchwave
Did you get it to work?
I'm stuck with the same problem.
Dutchwave replied on at Permalink Reply
Dutchwave
For me the following works:
if ($ni->hasSubmenu && $ni->level >= 2) {
        echo '<ul>'; 
    } elseif ($ni->hasSubmenu){
        echo '<ul class="dropdown m-menu">'; //opens a dropdown sub-menu
   } else {
        echo '</li>'; //closes a nav item
        echo str_repeat('</ul></li>', $ni->subDepth); //closes dropdown sub-menu(s) and their top-level nav item(s)
    }
}