Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 487 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get multiple parameters sent via drupal hook_menu

#1
I've got this menu hook below by which I'm sending two parameters to the function.

But in the function I am only receiving the first parameter.

Does any one know how to send and get multiple parameters using the Drupal menu system?

function drupal_menu(){
$items = array();
$items['drupal/%/%'] = array(
'title' => t('Welcome to the Hello World Module'),
'page callback' => 'drupal_page',
'page arguments' => array(1,2),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}


function drupal_page($arg1, $arg2) {
return drupal_json(array('mess1'=>$arg1,'mess2'=>$arg2));
}
Reply

#2
You're already doing it exactly the right way, if it's not working try flushing your caches. It's possible they haven't been cleared since you added the second argument, and Drupal caches items return from hook_menu() so it doesn't have to be called on each page.
Reply

#3
You are on the right way anyway ... If it is not working for you, then try the following

function drupal_page($arg1, $arg2) {
$arg1_new = arg(1) ;
$arg2_new = arg(2) ;
return drupal_json(array(
'mess1'=>$arg1_new,
'mess2'=>$arg2_new
)
);
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through