[support] question about hook_menu

Larry Garfield larry at garfieldtech.com
Thu Jun 3 01:22:39 UTC 2010


If arg() is your answer, you're asking the wrong question. :-)

As an experiment, Tim, can you try using a page callback that doesn't go 
through drupal_get_form?  It does some weird stuff, so you should eliminate 
that as a potential source of trouble.

I think what you're trying to do should work, which is why I recommend 
eliminating some variables.

--Larry Garfield

On Wednesday 02 June 2010 11:33:58 am Hadubard wrote:
> 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
> 


More information about the support mailing list