hook_menu variable number of wildcards?
_cc_ - November 8, 2009 - 17:29
I am trying to port a module from Drupal 5 to Drupal 6. The module takes a variable number of numerical arguments which are passed in the url ( /index.php?q=mod_name/1/1/0/2/1/0/2 etc) to generate and serve a download. This is easy in Drupal 5 as the callback function just gets passed all these values as arguments.
Is there a way to do this in Drupal 6? I read everything on wildcards I could find, but only found fixed numbers of arguments.

I figured it out, any extra
I figured it out, any extra args you pass are passed to the callback, so the code below, with this url:
index.php?q=mymod/1/2/3/4/5/6/7
prints 1/2/3/4/5/6/7
function mymod_menu() {
$items['mymod/%/%'] = array(
'title' => 'mymod',
'page callback' => 'mymod',
'page arguments' => array(1, 2),
'access arguments' => array('access mymod'),
'type' => MENU_CALLBACK,
);
return $items;
}
function mymod() {
$nargs=func_num_args();
for ($i = 0;$i < $nargs;$i++) {
print '/'.func_get_arg($i);
}
}