Hi all!
I need to set a menu item as "active" depending on 3 factors:
- Content type: for example, "news" items would activate the "News" primary menu item and "All" secondary menu item.
- Vocabulary: all taxonomy pages related to a certain vocabulary would activate a specific menu item. For example: vocabulary "Apples", term "Green" -> When viewing the taxonomy term "Green", the primary menu item "Fruits" must be active, and also the secondary menu item "Apples".
- Term: different terms into a certain vocabualry would activate a specific menu item. For example: vocabulary "Cars", terms "4x4" and "SUV". When viewing the taxonomy term page "SUV", the primary menu item "Cars" must be active, and also the secondary menu item "SUV". And, when viewing the taxonomy term page "4x4", the primary menu item "Cars" must be active, and also the secondary menu item "4x4".
How can this be done? Thank you!
Comments
am also looking for the same
am also looking for the same feature for one of the sites I build. Looking for some answers here.
Loving Life,
Tosho Freny,
Reading Sex and the Osho and other Dangerous Posts at BelovedOsho.com.
Anybody knows a PHP snippet
Anybody knows a PHP snippet to add in template.php or in page/node templates?
in menu.inc, you have the
in menu.inc, you have the following fct. You can override it in phptemplate and make some extra detection based on vocab/terms etc ...
Thank you very much for
Thank you very much for pointing us in the right direction. But I'm not a coder, and I would need some extra guidance, maybe an override example...
Any more clues please?
Any more clues please?
http://drupal.org/project/men
http://drupal.org/project/menutrails is supposed to do this, although I don't get it to work for now...
Right, "is supossed" to do
Right, "is supossed" to do this, but it doesn't work properly.
Menutrails works well for me
I have hacked around a bit in the past to solve the much simplier problem of 'menu items active depending on content type'. After adding the snippet to the template.php and configuring the module within the admin panel it worked like a charm.
Some thing like (But if you
Some thing like (But if you have really no php experienece, it will be a bit difficult ...)
But making comparaison on the "Titles" is not very clever since your title could change,
so you can identify the mid and make the test on it.
Maybe you could try http://drupal.org/project/taxonomy_menu , that generate menus from your taxonomy strcuture ...
How do you do it for Drupal
How do you do it for Drupal 6.x?
this doesn't work in Drupal
this doesn't work in Drupal 6, what am I missing?
replace function by function
replace function by
function phptemplate_menu_local_task($link, $active = FALSE) {
...
}
and it should work
Rem: Dont forget to empty your cache ... otherwise the function wont be called