开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜