Autonav nav-selected quirks

Permalink
I've looked through a lot of the related discussions on Autonav such ashttp://www.concrete5.org/community/forums/themes/highlight-active-l... and
http://www.concrete5.org/community/forums/usage/parent-child-pages-...
but so far cannot find an answer that works.

I have 2 Autonav blocks: one in the header that shows just the top level pages and nothing else, and one in the left sidebar that shows the sublevel pages of the top level page.

I am using CSS to highlight the nav-selected and nav-path-selected elements in the Autonav with a different colour. I want the full path to be highlighted for clarity, both the top level page, the subpage, and any further subpages, to the level of the current page. This is working fine for all the submenus in the sidebar nav, but as soon as I am on a subpage of one of the top level pages, I lose my highlighting of the top level page in the header nav.

Through inspection of the page, I see that when I am on a subpage, the <li> of the top level page still has its class of nav-selected, but the <a:> of the link contained in the <li> has lost its nav-selected class and so defaults back to the typology of the standard <a:>
Is this how it's supposed to be, and if so, how do I get around it so that the <a:> retains the nav-selected class?

stretchrt
 
stretchrt replied on at Permalink Reply
stretchrt
Bump

I have this in my header_menu.php:

if ($c->getCollectionPath() == $_c->getCollectionPath()) { 
   echo('<a class="nav-selected" href="' . $pageLink . '"  ' . $target . '>' . $ni->getName() . '</a>');
} else {
   echo('<a href="' . $pageLink . '"  ' . $target . '>' . $ni->getName() . '</a>');


If I have a "profile" page which shows in the header nav, with a child page of "people" which shows in the sidebar nav, once I am on the "people" page the "profile" link in the header nav loses its "nav-selected" class. I would have thought that it was still in the Collection Path, so why is it getting dropped?
stretchrt replied on at Permalink Reply
stretchrt
Don't worry just found the answer.

I needed
if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) {

instead of
if ($c->getCollectionPath() == $_c->getCollectionPath()) {