[development] problem with hook_menu

Steven Jones darthsteven at gmail.com
Tue Jun 30 08:45:16 UTC 2009


Looks like you've mixed implementations of hook_menu from Drupal 5 and
6. Webform module does something similar to what you want, have a look
at its code to see how it's done!

Regards
Steven Jones
ComputerMinds ltd - Perfect Drupal Websites

Phone : 0121 288 0434
Mobile : 07951 270 026
Twitter : darthsteven
http://www.computerminds.co.uk



2009/6/30 Hans Langouche <hans.langouche at gmail.com>:
> Hi,
>
> I'm running into a problem with the menu system.  I have a 'project' content
> type that has a couple of child links to show either some cck field of that
> node or some embedded views with related content (but I think what happens
> on those child paths is not relevant).  The problem I have is that these
> child paths often show the content of the parent (node) path instead of the
> content it's supposed to show (this will go away after clearing cache, but
> comes back again).
>
> Below is how I add the paths to the system, nodeapi then also adds aliases
> for each of those links (based on the alias of the parent link).  Note that
> this problem also occurs when I visit the link with the real path (e.g.
> node/x/more, so I guess the alias system is also not the cause).
>
> Originally I didn't add in the file and file path (as the hook_menu call is
> in the same module as the page callback's), I added it in to try to solve
> this cache (?) problem.
>
> Any suggestions or tips are appreciated :-)
>
> Hans
>
> if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(3)) {
> $_node = node_load(arg(1));
> if ($_node->type == 'project') {
>  $items = array();
>  $items['node/%node/more'] = array(
>    'title callback' => 'projecttabs_title',
>    'title arguments' => array(1,  t('more')),
>    'page callback' => 'projecttabs_tabs_more',
>    'page arguments' => array(1),
>    'file' => 'projecttabs.module',
>    'file path' => drupal_get_path('module', 'projecttabs'),
>    'access arguments' => array('access content'),
>    'type' => MENU_CALLBACK,
>  );
>


More information about the development mailing list