[support] question about hook_menu

Hadubard hadubard at gmail.com
Wed Jun 2 16:33:58 UTC 2010


You can access any additional arguments using the arg() function: http://drupalcontrib.org/api/function/arg/6
Then you only need the menu callback for sftp/% to be sure ther is at least one argument.

Am 02.06.2010 um 18:20 schrieb Tim Gustafson:

> 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
> 
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list