分享

drupal debug

 milton99 2011-10-26

Hi,
I'm developing a module and have some strange problems with hook_menu. i copied the code from a working module but it does not work exactly like the original menu. I want to know how can i trace menu calls of a specific url from the beginning and know what calculating it does which results in a wrong page, in order to know what's exactly wrong with my implementation.

I'm familiar with devel, and i already searched forum but i couldn't find anything useful.

Thanks.

Comments

First, did you clear the

First, did you clear the cache or rebuild the menus after tinkering with hook_menu? You need to do that in order to see the effect of your changes. Also, you might provide more details on your problem--what is the menu item that you think is not working?

Also, you might try something like this:

<?php
function YOURMODULE_menu_alter(&$callbacks) {
 
//  DEBUGGING OUTPUT.
 
foreach ($callbacks as $path => $options) {
   
$access = $options['access callback'] ? $options['access callback'] : 'user_access';
   
$page = $options['page callback'] ? $options['page callback'] : 'no page callback';
    echo
$path . " | ". $page . " | " . $access . " | " . implode(', ', $options['access arguments']) . '<br />';
  }
}
?>

once you've defined this in a module, you rebuild your menus or cache. I use this to get a dump of the entire menu structure. This should show you exactly which 'page callback' function is being executed for a given path, provided that there are not downstream modules that use menu_alter to change the structure.

Hope that helps!

Doug Stumberger
www.
dstumberger --AT-- hotmail --DOT-- com

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多