开发者

Drupal module menu item not showing in menu primary-links

I'am trying to get a menu item to show in the 'primary-links'.

i've read this, but that is not working. What am I doing wrong?

/**
 * Implementation of hook_menu().
 */
function modulename_menu() {
    $items = array();

    $items['test'] = array(
            'title' => t('test'),
            'description' => 'some description',
            'page callback' => 'module开发者_开发技巧name_function',
            'access callback' => TRUE,
            'type' => MENU_NORMAL_ITEM,
            'menu_name' => 'primary-links',
    );

    return $items;
}

So i would expect 'test' to show up next to my other primary-links.

I added the 'primary-links' block to the header and logged in as user/1 but still the 'test' link is not showing in the menu or header bar.

Using Drupal 6.x with the Garland theme.


When adding module menus, you have to either manually run the menu_rebuild() function or visit the modules page at admin->build->modules (visiting this page runs the menu_rebuild function) and then clear the cache. It seems that Drupal should just show the menu items as they are added, but even with caching off they are cached: caching only applies to content. This has to be done every time a menu item is added or changed.

To sum:

  1. Hard refresh on the modules page
  2. Clear the cache.

This guy has written about it as well: http://data.agaric.com/node/1818


As said in a comment at Andrews link.

using the devel module and using the 'Rebuild menus' link is an even more easyer way It basicly does the same, but it now only takes you one mouse click ;)

If you don't have devel installed, go and install it! It is ha handy (or must have) tool if your developing modules.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜