I got a page where I link to in the menu bar. On this page there is a custom module. On this page there are items from anothor database where the user can click on. When they click on it they go to another page with more information. When they are on the second page there is no active button in the menu bar. On the second page I also have a custom module.

How can u force a button in the menu bar to have the .active class or in another way so that it haves the active lay-out button.

I use Drupal 7.

  • Have a look at the context module. It deals with setting active menu items based on conditions.
    – Sam Becker
    Commented Jul 9, 2012 at 13:50

2 Answers 2


The Menu position module will solve your problem.

Often times site builders want certain types of content to appear in a specific position in the navigational menu. The simplest solution, adding all of that content individually to the menu system, has performance and usability issues. (Imagine hundreds of menu items added to one spot in the menu.)

This module allows for the creation of rules that will dynamically add the current page into the menu system at the requested spots.


You can use http://drupal.org/project/context to set an active menu.

Context allows you to manage contextual conditions and reactions for different portions of your site.

Or use the API http://api.drupal.org/api/drupal/includes!menu.inc/function/menu_tree_set_path/7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.