How to add classes for styling to Drupal when using menu_block?

Posted by VoY on Stack Overflow See other posts from Stack Overflow or by VoY
Published on 2009-12-06T17:06:32Z Indexed on 2010/04/24 3:23 UTC
Read the original article Hit count: 359

Filed under:
|
|
|

I'm using the menu_block module in Drupal for my menus. This works very well, but I want my menu items styled as an image menu. This cannot be done nicely with the default settings - the menu items look something like this:

<li class="leaf first menu-mlid-199"><a href="/this/is/some/nice/url" title="Homepage">Homepage</a></li>

I'm guessing I could used the menu-mlid-199 class to get the styling I want, because it's a unique id of each menu item, but that seems rather ugly to me. Is there any other way to add reasonably named classes to my menu items, e.g. generate them from the page title or url alias? Even just a sequence would seem nicer - like menu-item-1 and so on.

© Stack Overflow or respective owner

Related posts about drupal

Related posts about php