Wierd menu problem
Can someone explain why the first menu item does not work, but the second one does? function simple_menu_menu() { $items = array(); $items['simple_menu'] = array( 'page callback' => '_simple_menu_view', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); $items['_menu_view'] = array( 'page callback' => '_simple_menu_view', 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); return $items; } Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
They are the same except the path name. The one that starts with an underscore works. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Jeff Greenberg Sent: Thursday, December 17, 2009 7:08 PM To: development@drupal.org Subject: Re: [development] Wierd menu problem On 12/17/2009 6:44 PM, Nancy Wichmann wrote: Can someone explain why the first menu item does not work, but the second one does? I don't know why, but it would seem to be the underscore in the name? No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.716 / Virus Database: 270.14.111/2570 - Release Date: 12/17/09 14:40:00
Nancy Wichmann wrote:
Can someone explain why the first menu item does not work, but the second one does?
function simple_menu_menu() {
$items = array();
$items['simple_menu'] = array(
'page callback' => '_simple_menu_view',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['_menu_view'] = array(
'page callback' => '_simple_menu_view',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
My guess is something external is happening. Maybe you're getting a collision on the simple_menu path?
I thought of that and can't find any other items like that in the menu_links table. And, BTW, it doesn't seem to matter what the string is, if it starts with an alpha character, it fails; with the underscore it works. Makes no sense to me. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Earl Miles Sent: Thursday, December 17, 2009 8:25 PM To: development@drupal.org Subject: Re: [development] Wierd menu problem Nancy Wichmann wrote:
Can someone explain why the first menu item does not work, but the second one does?
function simple_menu_menu() {
$items = array();
$items['simple_menu'] = array(
'page callback' => '_simple_menu_view',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
$items['_menu_view'] = array(
'page callback' => '_simple_menu_view',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
My guess is something external is happening. Maybe you're getting a collision on the simple_menu path? No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.716 / Virus Database: 270.14.112/2571 - Release Date: 12/17/09 14:40:00
On 12/18/2009 1:48 AM, Nancy Wichmann wrote:
I thought of that and can't find any other items like that in the menu_links table. And, BTW, it doesn't seem to matter what the string is, if it starts with an alpha character, it fails; with the underscore it works. Makes no sense to me.
You've probably tried this, but if not, try switching the order, and also try adding a third item in front of the other two...to eliminate it being positional.
No, I haven't tried that yet, but I have tried it with only one menu item and it worked the same way: with an underscore it worked, without, it did not. Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org] On Behalf Of Jeff Greenberg Sent: Friday, December 18, 2009 1:55 AM To: development@drupal.org Subject: Re: [development] Wierd menu problem On 12/18/2009 1:48 AM, Nancy Wichmann wrote:
I thought of that and can't find any other items like that in the menu_links table. And, BTW, it doesn't seem to matter what the string is, if it starts with an alpha character, it fails; with the underscore it works. Makes no sense to me.
You've probably tried this, but if not, try switching the order, and also try adding a third item in front of the other two...to eliminate it being positional. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.716 / Virus Database: 270.14.112/2571 - Release Date: 12/17/09 14:40:00
Nancy Wichmann wrote:
No, I haven't tried that yet, but I have tried it with only one menu item and it worked the same way: with an underscore it worked, without, it did not.
Obviously that's not normal, since none of Drupal uses underscores in its menu paths. Something is wrong that is not in the hook_menu().
Do a fresh 6.15 install and bring over just that module. Does it happen there? You may have another copy of the module lying around somewhere (check the system table to make sure you're debugging the right one). Earl Miles wrote:
Nancy Wichmann wrote:
No, I haven't tried that yet, but I have tried it with only one menu item and it worked the same way: with an underscore it worked, without, it did not.
Obviously that's not normal, since none of Drupal uses underscores in its menu paths. Something is wrong that is not in the hook_menu().
On 12/17/2009 6:44 PM, Nancy Wichmann wrote:
Can someone explain why the first menu item does not work, but the second one does?
Ah, would help if I read more closely. Well, then tangentially thinking, maybe try dumping the array after the menus are rendered and see if something else is clobbering that entry.
I tested this code on one of my D6 dev sites and it works properly. Thus, you either need to explain what "does not work" means for you. Or you have another module installed that hi-jacks your menu router items, in which case I'd try to disable most/all other modules step by step to see who's guilty. In addition to that, it is also possible that some other module is dynamically registering menu router items based on user configuration. For example, a view or panel that's configured for the path 'simple_menu'. Furthermore, if you have Path module enabled, and you have a URL alias 'simple_menu' in your system, then this URL alias will be normalized to its internal system path during bootstrap, before the menu router is consulted. Hence, if you see the output of 'node/123' instead of what you expected, then you have a URL alias clash. Hope that helps. sun
Daniel F. Kudwien wrote:
I tested this code on one of my D6 dev sites and it works properly.
Thus, you either need to explain what "does not work" means for you. Or you have another module installed that hi-jacks your menu router items, in which case I'd try to disable most/all other modules step by step to see who's guilty.
Or you might need to clear the caches, if you haven't done that already (my personal favorite thing to forget to do when banging my head against the table when menu items aren't working in modules). --Jennifer -- Jennifer Hodgdon * Poplar ProductivityWare www.poplarware.com Drupal, WordPress, and custom Web programming
participants (6)
-
Daniel F. Kudwien -
Earl Miles -
Jeff Greenberg -
Jennifer Hodgdon -
Marc Poris -
Nancy Wichmann