By ball.in.th on
Hi,
According to page_example_menu(), it seems that wildcard is optional. That is:
$items['bar/baz/%/%'] = array(
'title' => 'Baz',
'page callback' => 'page_example_baz',
'page arguments' => array(2, 3),
'access arguments' => array('access baz'),
'type' => MENU_CALLBACK,
);
should match bar/baz/1/2, bar/baz, and, by my own assumption, /bar/baz/1. However, i got "Page not found" for both /bar/baz/1 and bar/baz while bar/baz/1/2 do work fine. So, the doc is incorrect or am I missing something? If I want to make both wildcards optional, do I have to do something like the following?
$items['bar/baz] = ...
$items['bar/baz/%'] = ...
$items['bar/baz/%/%'] = ...
Comments
The correct way
If you want to make the wild cards optional use
And then in the page callback should look something like
And if something is supplied like /bar/baz/1 then $arg0 will have a value of 1
Jacob Henke
http://www.jacobhenke.net
Thanks a lot!! Perhaps the
Thanks a lot!! Perhaps the document at http://api.drupal.org/api/function/page_example_menu/6 should be corrected, specifically this sentence "If the user accesses http://example.com/?q=bar/baz, the menu system will find a match and execute page_example_baz().".
--
http://ball.in.th, http://บอล.th - ชุมชนคอบอลอันดับ 1 (ยังไม่ใช่ แต่เราจะไปให้ถึง 555)