Main Navigation selected while surfing subpages
Permalink
Hello,
is it possible to have the main menu item selected while browsing subpages of that item?
Or do I have to program a database request for this?
Hauke
is it possible to have the main menu item selected while browsing subpages of that item?
Or do I have to program a database request for this?
Hauke
I added a feature request since I could use that in two of my projects..
http://www.concrete5.org/community/features/main_navigation_selecte...
http://www.concrete5.org/community/features/main_navigation_selecte...
thanks for your help, did it with strpos and it works great.
I did this:
Hope this helps!
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $aBlocks = $controller->generateNav(); global $c; echo("<ul>"); $isFirst = true; foreach($aBlocks as $ni) { $_c = $ni->getCollectionObject(); if (!$_c->getCollectionAttributeValue('exclude_nav')) { if (strpos($c->getCollectionPath(), $_c->getCollectionPath()) === 0) { $navSelected='nav-selected'; $dilim='<strong>»</strong>'; // optional text before active parent } else { $navSelected = ''; $dilim='';
Viewing 15 lines of 26 lines. View entire code block.
Hope this helps!
Already got this to work, but thank you for your help. I did use the same sort of code, but exchanged strpos with strcmp in order to avoid nav-selected when the site have similar names.
Regards
Regards
Sorry to bring back an old thread, but i'm having trouble with the above using concrete 5.3.3.1.
The code shown above does the job of selecting the parent page as well, but it stops the 'replace_link_with_first_in_nav' function working, which in my case is needed.
Does anyone have any suggestions to make both work together?
Thanks for any help guys!
The code shown above does the job of selecting the parent page as well, but it stops the 'replace_link_with_first_in_nav' function working, which in my case is needed.
Does anyone have any suggestions to make both work together?
Thanks for any help guys!
have a look at this thread:http://sourceforge.net/forum/message.php?msg_id=5019334...