I'm developing a module, something similar to Talk module, which allows to have reviews or comments on a separate page, not on the bottom of a node page. As you may know, even if your node has an alias like: http://example.com/great-film, its talk page url will look like: http://example.com/node/1/talk ... but I want to make it accessible via http://example.com/great-film/talk ...
I tried to create hook_menu like this:
$items['%/talk'] = array(
'page callback' => 'talk_page',
'page arguments' => array(0),
'access callback' => 'user_access',
'access arguments' => array('access content'),
);
But it doesn't work. Pathauto won't help also, because '/talk' isn't a node, this is a custom url ... so my idea is to make Drupal somehow recognize '%/talk' slug (instead of % it should have node's alias) ... is it possible to do this somehow? Any ideas?
Comments
hook_pathauto + hook_nodeapi
first create menu item like $items['node/%node_id/talk']
then you can refer following code it will insert alias for your menu item when new node inserted.. please add check for your content type.
Wow, Kuldip Gohil, thanks
Wow, Kuldip Gohil, thanks alot! I'll check this and will let you know how this goes!
My web production and development blog. I do Drupal development.
Or simpler...
You can just use this module: Extended path aliases