Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By obloxeon on
I want to have my main navigation set as the primary links and the secondary links dependent on what link I click from the primary. For example, primary has articles, forum, about us (just using 3 for the time being). If I click articles, I want the secondary links to fill with the categories I setup for stories. If I click about us, it won't display the article categories. How do I go about doing this? Any help would be greatly appreciated. Thanks in advance!
Comments
Visit Administer > Site
Visit Administer > Site building > Menus > Settings and make sure "Menu containing primary links" and "Menu containing secondary links" are set to the same menu (most likely "Primary Menu" ). Then add the secondary items as children of the appropriate primary item. Your theme will also need to print the secondary menu (links).
Thanks, worked perfectly,
Thanks, worked perfectly, but how do I make it so the primary link stays highlighted when the secondary menu is open?
Ahhhh now we're talking ..!
I think this finally works out of the box in D6. The easiest way I've found in D5 (a real hack I'm afraid!) is to edit my theme's page.tpl.php and change the line that outputs the primary links, which will be something like this
to
Obviously you can do whatever you want with the classes, and apply an 'id' in the same way if you want.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
My page.tpl.php has this for
My page.tpl.php has this for primary and secondary:
and my template.php has this:
How would I change those?
Easy
You could do it in your custom theme function then! Just change the last line:
Should work because your theme function in turn invokes theme('links', ...) which adds the (largely useless) class "menu-something-active".
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Thank you so much. Worked
Thank you so much. Worked perfectly. =)
One other thing incase you might know: If I set a link for "Home" as a primary link to "
<front>
", how can I show a blank secondary bar because whenever I click home or the homepage is displayed, the secondary bar which goes with the theme and look of the site isn't shown. Works fine when I have children or when I link to a static page. Any thoughts?Ooops
Finger trouble ...
gpk
----
www.alexoria.co.uk
>Works fine ... when I link
>Works fine ... when I link to a static page
Don't quite follow, but maybe not important.
Just remove the PHP if (isset(..)) and endif blocks in your page.tpl.php. Then any empty primary/secondary links' div will always be shown.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Doh, totally overlooked the
Doh, totally overlooked the obvious. Thanks again. =)
6.4 still same issue...
Hi there,
I want to achieve the same thing, in Drupal 6.4, and tried it with the four seasons theme (http://drupal.org/project/fourseasons), but am puzzled about keeping the primary links highlighted when on a second level link... I wrote a post about this as well: http://drupal.org/node/300641.
Any ideas?
Thanks in advance!
www.druifdesign.nl
In Administer > Site building
In Administer > Site building > Menus > Settings I cant see any options like "Menu containing primary links" and "Menu containing secondary links" in Drupal 6.10. It is "Default menu for content", "Source for the primary links" (both Primary link) and "Source for the secondary links" which is set to secondary links.
What shall I do? I will make all these three options to "primary links"?
Regards,
-S-