[support] question about hook_menu

Tim Gustafson tjg at soe.ucsc.edu
Wed Jun 2 16:20:00 UTC 2010


Hi,

I'm trying to create a module that creates a web-based SFTP file browser.  I've defined a menu item like this:

$items["sftp/%"] = array(
  "title" => "File Access",
  "access arguments" => array("access content"),
  "page callback" => "drupal_get_form",
  "page arguments" => array("sftp_index", 1),
  "type" => MENU_CALLBACK,
);

The sftp_index function is getting called correctly for paths like:

/sftp/foo
/sftp/bar

But when I go to:

/sftp/foo/bar

my function is only getting the "foo" part of the URL, and not "bar".  How can I capture the entire additional URL into an argument to the function?  Doing something like creating an "sftp/%/%" items and then an "sftp/%/%/%" item (and so on) obviously won't work, as the path names can get arbitrarily large and complex.

Is there any way to cause the menu system to capture the entire URL path after the "sftp/" part and pass it to the function?

Tim Gustafson
Baskin School of Engineering
UC Santa Cruz
tjg at soe.ucsc.edu
831-459-5354



More information about the support mailing list