Parent child pages and nav selected...

Permalink
I have a tricky problem that might not be so tricky for some of you.

I have a superfish nav at the top and then an auto nav on the side and then another autonav at the bottom.

It works like this. The top Nav says WORK. When you click on WORK you go to another page with the nav on the side. This page is called CLIENTS. So you are in WORK >CLIENTS. Then you click a CLIENT and there is a nother Nav for the clients projects.

So you are in WORK > CLIENTS > PROJECT 1 for instance.

My problem is I want WORK > CLIENTS and > PROJECT 1 all to show Nav selected. So you can see where you are.

Currently I cant do this because once I leave the work page the nav selected turns off because its on another page and the clients nav is the selected one.

All the pages are within the Work page or children of that page so I was wondering if there was a way to keep all the Parent child navs in select mode as you click through them.

I don't want to use a:visited because everything ends up highlighted. Nav-selected is the answer but it needs to have this Parent Child dimension.

If anyone knows what Im banging on about could they perhaps offer a solution??

Nige

nige
 
2BitMarv replied on at Permalink Reply
2BitMarv
are you familiar with editing block templates? then the way is more easy! The magic lies within the $c->getCollectionID(). Per default this is requested like "if you are you then highlight you" but you want to have "if you are a node on the way down to the current viewed site, then highlight you" and this is done on every navigation element. So you got to change from $c->getCollectionID() to $c->getCollectionPath(). In this path every parent side node will be highlighted

if ($ni->isActive($c) || strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) {
            echo('<li class="nav-selected'.$isFirstClass.'"><a title="'.$c->getCollectionID().'" class="nav-selected" href="' . $pageLink . '">' . $ni->getName() . '</a>');
         } else {
            echo('<li class="'.$isFirstClass.'"><a title="'.$c->getCollectionID().'" href="' . $pageLink . '">' . $ni->getName() . '</a>');
         }
nige replied on at Permalink Reply
nige
Thats brilliant Marv, should I use this code in templates of Superfish and autonav view.php?

You see I'm pretty much .php illiterate, which is my problem, but I can understand what you're saying and maybe even where to implement it.

Generally I make block templates with view.php and then I just change either styles or an obvious line of php. The php part is just guessing really.

In your example I'm not sure a) where to put this code and b) which parts of the code to change.

BUT Im going to have a go...

Thanks a lot, at least I know I can do it...

P.S. Its not as simple as just changing getCollectionID() to getCollectionPath() is it?
r1digital replied on at Permalink Reply
r1digital
Perfect - been looking for this all night ;)