/ Published in: PHP
Place the following function in your theme's template.php
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * Theme override for theme_menu_item() */ function phptemplate_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf')); $class .= ' '. $extra_class; } if ($in_active_trail) { $class .= ' active-trail'; } // Add unique identifier static $item_id = 0; $item_id += 1; $id .= ' ' . 'menu-item-custom-id-' . $item_id; // Add semi-unique class return '<li class="'. $class .'" id="' . $id . '">'. $link . $menu ."</li>\n"; }
URL: http://drupal.org/node/310356#comment-1210124