This question has been posted numerous times but can not find a definitive answer.
I want to be able to pass arguments on page type nodes. This is achievable by doing something like browse?song=X However in keeping with clean urls I need it to be browse/X, such a path creates a 404 not found.
So we use hook_menu to allow for such paths. This is where I am gettin stuck. I can do something like
(I do not need to do anything with the actual agrument variables in hook_menu, I use them elsewhere)
$items['browse/%'] = array(
'page callback' => 'browse_callback',
'page arguments' => array(1),
'access arguments' => array('access content')
);
function browse_callback() {
$node = node_load(3); //the actual NID
return node_view($node, $view_mode = 'full', $langcode = NULL);
} //No need to do anything with argument variables - used elsewhere /need to prevent 404
And then use arg() elswhere to obtain variables.
HOWEVER - I dont like the idea of using my own callback to display a node, something of which is already happening. So how can I adjust the following. To do exactly as above. Thanks.
$items['browse/%node'] = array(
'access callback' => 'node_access',
'access arguments' => array('view', '1'),
'page callback' => 'node_page_view',