It's possible to add "active" class to the selected menuitem?

Like

<ul class="menu">
<li class="active leaf odd"><a href="sport" title="Sport">Sport</a></li>
<li class="leaf even"><a href="fashion" title="Fashion">Fashion</a></li>
</ul>

Thx, Paul

Comments

richi’s picture

Hi,

this feature would be very nice for me too.

So i did a little patch on my drupal-system:

File: node_breadcrumb.module
Function: _node_breadcrumb_set_location

After the last line "menu_set_location($location);"
Add:

  // PATCH - set menu active
  for ($i = (sizeof($location)-1); $i >= 0; $i--) {
  	print_r ($location[$i]);
  	$menu_item = menu_get_item(NULL, $location[$i]['path']);
  	print_r($menu_item);
  	if ($menu_item['type'] != 118) {
  		continue;
  	}
  	menu_set_active_item($location[$i]['path']);
  	break;
  }

At my case it works good, maybe it helps someone else.

paloczp’s picture

Hm, not too perfect!

When I use this, lost the "tabs primary" (Preview | Edit etc.)

Thx, Paul

joachim’s picture

Look at menu_trails module for code to do this -- it has to go in your theme.