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:
  • 355 Vote(s) - 3.64 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the difference between MENU_NORMAL_ITEM and MENU_CALLBACK?

#1
What is the difference between MENU_NORMAL_ITEM and MENU_CALLBACK?
Reply

#2
`MENU_NORMAL_ITEM` creates a menu item while `MENU_CALLBACK` doesn't. That is the only difference.
Reply

#3
Addition to the above comment, MENU_CALLBACK can be used in some scenarios such as AJAX.
Example: example.com/ajax/country_list is a MENU_CALLBACK which returns a list of countries in HTML,JSON or XML format... This menu doesn't appear in the browser.
You can visit [

[To see links please register here]

][1] for more information.


[1]:

[To see links please register here]

Reply

#4
The more precise answer is that `hook_menu()` creates router items, and also menu links are generated. `MENU_NORMAL_ITEM` generates a menu link which will appear in the navigation menu, while `MENU_CALLBACK` does not add a menu link, so it won't appear in the menu.
Reply

#5
Drupal maps urls to functions.
Means you need a function for every URL.The function is mostly present in a module.
ex mysite/add will have a mapping to a function in a module.
Many cases we don't want the URL as as a menu item but intend to use it for other purposes. The best example being a Ajax callback.
Ex: you have an auto-suggest form which calls a function suggest in the server.The front end Ajax will need a url to fire the request.Let the url be

[To see links please register here]

This is the case when you need a MENU_CALLBACK

function example_menu() {
$items['suggest'] = array(
'page callback' => 'example_suggest',
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
function example_suggest() {
//you can return the autosuggested items to the page
}

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

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