In most cases, you can and should use hook_menu to handle the url and the parameters in it. Have a look at the following sample code, taken from http://api.drupal.org/api/function/page_example_menu/6:
function page_example_menu() {
// This is the minimum information you can provide for a menu item. This menu
// item will be created in the default menu: Navigation.
$items['example/foo'] = array(
'title' => 'Page example: (foo)',
'page callback' => 'page_example_foo',
'access arguments' => array('access foo content'),
);
// By using the MENU_CALLBACK type, we can register the callback for this
// path but do not have the item show up in the menu; the admin is not allowed
// to enable the item in the menu, either.
//
// Notice that the 'page arguments' is an array of numbers. These will be
// replaced with the corresponding parts of the menu path. In this case a 0
// would be replaced by 'bar', a 1 by 'baz', and like wise 2 and 3 will be
// replaced by what ever the user provides. These will be passed as arguments
// to the page_example_baz() function.
$items['example/baz/%/%'] = array(
'title' => 'Baz',
'page callback' => 'page_example_baz',
'page arguments' => array(2, 3),
'access arguments' => array('access baz content'),
'type' => MENU_CALLBACK,
);
return $items;
}
This function is an implementation of hook_menu. In this example, two paths are registered: 'example/foo' and 'example/baz/%/%'. The first path is a simple path without parameters; when requested, the function page_example_foo()
is called without parameters. The second path is a path with two parameters ('arguments'). When this path is requested, Drupal will run the function page_example_baz($argument1, $argument2)
. This is considered 'the right way' to have url's with parameters.