selected navigation item
Permalink 1 user found helpful
Is there a way to indicate a css class for the current navigation item? I'd like to set an "active" class on the navigation link for the current page?
I don't know how I didn't notice that. That brings up another question though. How do I get my index/default page to show in the navigation?
We used to have an option for this in the autonav but it was buggy, so we removed it.
It does seem like people would like it back, though, so perhaps it will come back in an updated version of the autonav.
It does seem like people would like it back, though, so perhaps it will come back in an updated version of the autonav.
I always come across this issue when building CMS websites in various commercial CMSs. The problem is the home page is a single node on the top level, but in the navigation you want it to appear as if it were on the first level. i.e. the same level as all its children. I didn't find any problems with the checkbox there used to be for this purpose though? Might be worth bringing that back :)
Paul.
http://www.AntropyConsulting.com
Paul.
http://www.AntropyConsulting.com
Did this ever come back?
I need this functionality and it would be nice to know if there's a simple way to do it.
I basically just need to know what to call my "current" or "selected" class in the CSS file (I hope).
Thanks,
Nate
I need this functionality and it would be nice to know if there's a simple way to do it.
I basically just need to know what to call my "current" or "selected" class in the CSS file (I hope).
Thanks,
Nate
The CSS class is ".nav-selected".
If you want to add the home page to your nav, copy the file "header_menu.php" from the YOURSITE/concrete/blocks/autonav/templates/ directory to a new directory (you'll need to create this):
YOURSITE/blocks/autonav/templates/
Edit that file and add this code just above the "$isFirst = true;" line:
(note that you should ignore the "<?php" and "?>" tags in there -- those are put in automatically by the forum, but shouldn't actually be pasted into your code).
Now click on the autonav block in edit more (or add it to the page and then click on it) and choose "Custom Template" from the menu, then choose "Header Menu" from the list.
That should work (and you can of course change the word "Home" in the code sample so it says whatever you want).
-Jordan
If you want to add the home page to your nav, copy the file "header_menu.php" from the YOURSITE/concrete/blocks/autonav/templates/ directory to a new directory (you'll need to create this):
YOURSITE/blocks/autonav/templates/
Edit that file and add this code just above the "$isFirst = true;" line:
$homeClass = (0 == $c->getCollectionParentID()) ? 'nav-selected' : ''; echo '<li class="'.$homeClass.'"><a href="'.DIR_REL.'">Home</a></li>';
(note that you should ignore the "<?php" and "?>" tags in there -- those are put in automatically by the forum, but shouldn't actually be pasted into your code).
Now click on the autonav block in edit more (or add it to the page and then click on it) and choose "Custom Template" from the menu, then choose "Header Menu" from the list.
That should work (and you can of course change the word "Home" in the code sample so it says whatever you want).
-Jordan
So an example of a complete nav (Well a Nav of two items About and Contact Us with About selected):
This is automatically produced based on the pages included in your sitemap in C5.
In my template the following PHP code produces the example above.