[development] hook_menu vs path alias Drupal 7

nan wich nan_wich at bellsouth.net
Thu Feb 17 14:38:08 UTC 2011


I haven't looked at that code in D7 yet, but based on D6, I am going to guess 
that it hasn't changed. The URL alias is resolved to the underlying "node/1234" 
before the menu is looked at. Since the menu specifies "article/hello," it does 
NOT match "node/1234" and therefore executes the standard "node/%nid" path 
instead. If you change the menu path to "node/1234," I bet it will do what you 
want.
 
Nancy
 
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.




________________________________
From: Deva <devendra.in at gmail.com>
To: development at drupal.org
Sent: Thu, February 17, 2011 8:41:21 AM
Subject: [development] hook_menu vs path alias Drupal 7

Hi All,

I am developing a site in Drupal 7. I have a node with alias /article/hello
I also have a hook_menu with "/article/hello" path registered in my module.
When i access the path in browser http://localhost/article/hello it shows the 
node instead of calling "my_custom_function".

$items['article/hello'] = array(
    'title' => 'Hello World', 
    'description' => 'Hello world', 
    'page callback' => 'my_custom_function', 
    'access arguments' => array('access content'), 
    'type' => MENU_CALLBACK,
);

I want 'my_custom_function' to get called.
Appreciate your help.

-- 
:DJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110217/3f335ea4/attachment.html 


More information about the development mailing list