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

hauke
 
Remo replied on at Permalink Reply
Remo
but it's a bit difficult..

have a look at this thread:http://sourceforge.net/forum/message.php?msg_id=5019334...
Remo replied on at Permalink Reply
Remo
I added a feature request since I could use that in two of my projects..

http://www.concrete5.org/community/features/main_navigation_selecte...
hauke replied on at Permalink Reply
hauke
thanks for your help, did it with strpos and it works great.
jelthure replied on at Permalink Reply
jelthure
I did this:
<?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>&raquo;</strong>'; // optional text before active parent
         } else {
            $navSelected = '';
            $dilim='';


Hope this helps!
hauke replied on at Permalink Reply
hauke
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
OliR replied on at Permalink Reply
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!