Here's the implementation of hook_menu()
in my theme, "myTheme":
function myTheme_menu() {
$items = array();
$items['ajax'] = array(
'title' => 'AJAX',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK
);
$items['blog'] = array(
'title' => 'sonia blog',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK
);
return $items;
}
example.com/ajax is working fine, but example.com/blog is returning me a "page not found" error. I have cleared my cache.
Do you have any idea about what is going wrong?
EDIT
One of the commenters suggested that I need a page_callback
property. However, the documentation on hook_menu
does not say that it's required. Regardless, I tried adding this callback but still no luck. Here's the code with it:
function myTheme_menu() {
$items = array();
$items['blog'] = array(
'title' => 'sonia blog',
'access arguments' => array('access content'),
'page callback' => 'myTheme_callback_blog',
'type' => MENU_CALLBACK
);
return $items;
}
function myTheme_callback_blog(){
return '';
}
/blog
is not already defined by another module ? Did you try another path, just for checking ?/blog
is used by the core Blog modulepage callback
property, seehook_menu()
for more detailspage callback
then the pathpage/sub-page
will inherit it. Otherwise its required or Drupal has no function to run to get the page content :) Not sure why theajax
path works though so maybe that's not quite right. As others have said though,blog
is already a defined path so you need to alter it inhook_menu_alter()
rather than redefine it