Remove/ trim a number of links from drupal navigation
How would I trim/ unset a certain num开发者_Go百科ber of menu from drupal navigation menu to avoid lengthy menus for a specific page? Say I want to remove the last 20 menu items from navigation menu.
Any advice would be very much appreciated.
Thanks
You could do it at the theme layer easy enough by theming your menu.
See theme_links()
http://api.drupal.org/api/function/theme_links/6
Perhaps something like:
function mytheme_links($links, $attributes = array('class' => 'links')) {
$length = variable_get('mytheme_menu_length', 22);
$links = array_slice($links, 0, $length);
return theme_links($links, $attributes);
}
There are other ways also. You could hide some with CSS or build the $links array yourself but the menu api doesn't really have an interface for this.
See menu_navigation_links(). http://api.drupal.org/api/function/menu_navigation_links/6
精彩评论