Hello,

I would like to pass arguments to my gallery nodes, just to mark which photo (if any) needs to be highlighted.

I've got this:

  $items['gall/%node/%photo'] = array(
    'title' => 'Gall img',
    'page callback' => 'node_page_view',
    'page arguments' => array(1),
    'access callback' => 'node_access',
    'access arguments' => array('view', 1),
    'type' => MENU_CALLBACK,
  );

but unfortunately menu system doesn't work with aliases so url 'gall/14/2' do not exists. For item like 'node/%node/%photo' and url like 'node/14/2' everything works fine.

Is there a way to have aliased paths with arguments and do not use views, panels, etc. ?
In views it's so easy to create aliased path with arguments ;)

Comments

nagarajanl’s picture

If the 'pathauto' module just make the URL alias pattern for the gallery nodes to gall/[nid]/[photo_id]...Infact i believe you don't need the above hook_menu() implementation here...For more information http://drupal.org/project/pathauto

altavis’s picture

All photos are stored as a multi-value CCK field. Pathauto won't handle this.

I found http://drupal.org/project/subpath_alias and it should do fine. I wonder how Views can handle this in so elegant way - but looking into it's source scares me more ;)

altavis’s picture

Just used this: http://drupal.org/project/url_alter

with custom_url_rewrite_inbound() set as:

if (preg_match('|^gall(/.*)|', $path, $matches)) {
  $result = 'node'. $matches[1];
}