Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By johnhanley on
Even though the URL param reads "?q=cases/details/26", arg(0) equals "cases" but arg(1) and arg(2) are empty.
What could be the problem?
Thanks.
Comments
$_GET['q']
BTW, $_GET['q'] equals "cases" only.
what's the menu call
and the function name?
I've been looking at the menu call...
...since my original post.
The function is called cases_detail().
The menu items[] definition looks like this:
Try
getting rid of the type parameter. That one isn't well documented and is a particular thorn in my side. Taking it out won't cause an additional problem cause I never use it. You can turn it off and on under administer>menu if you need to.
It turns out...
... that the "type" parameter wasn't the problem.
It seems the menu hook didn't like my choice of callback function names. I managed to get the callback function by using the "_page" suffix. This also solved my arg() parameter value problem. Cool, but now there's a new issue. Using the "_page" suffix in my function name unwantingly creates a new itme in my navigation tree.
My new question: how do you create a callback function to display a page of content without adding a nav item? Should I use one callback function with a conditional statement to call the appropriate sub function?
Thanks.
I don't understand _menu
Drupal doc is unintelligible on it as always.
My recommendation is to go to administer > menu and manually delete it.
I hate workarounds
I'll keep playing with hook_menu and report back.