4

In my module file I created a new menu item

function xmlproject_menu() 
{
  $items = array();

  //more items here

  $items['system/xml/cfa/initialize/%/%/%/%/%'] = array(
    'page callback' => 'xmlproject_initialize_cf',
    'page arguments' => array(4, 5, 6, 7, 8,),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function xmlproject_initialize_cf($session_id, $cart_id, $pid, $rid, $partner_id)
{
  //some code here
}

I have tried going to admin/build/modules, devel/menu/reset, and admin/settings/performance to clear the cache. I can see the menu item in the database (menu_router). enter image description here

When I go to http://example.com/system/xml/cfa/initialize/1/2/3/4/5 I am getting "Page not found".

apaderno
  • 28,547
  • 16
  • 75
  • 90
AllisonC
  • 2,973
  • 4
  • 29
  • 46

3 Answers3

1

You code seems all dandy, but I suppose your page callback "xmlproject_initialize_cf" should actually return something.

Try this:

function xmlproject_initialize_cf($session_id, $cart_id, $pid, $rid, $partner_id)
{
  // Your Code
  return 'Hello world!';
}

Is the modules name "xmlproject"?

1

Does not seems anything wrong with your code. Just curious, why you have kept the last element of array as 'empty' (a comma after number 8)

'page arguments' => array(4, 5, 6, 7, 8,),

Also, there is additional empty item in the array (extra comma after MENU_CALLBACK)

'type' => MENU_CALLBACK,
Gyanendra Dwivedi
  • 5,511
  • 2
  • 27
  • 53
1

As you see in your database number_part column that contains Number of parts in router path,sets to 7(maximum available part),but your parts of menu callback is 9.Which is more than MENU_MAX_PARTS available in drupal 6. this is why you're getting Page not found Just reduce your menu item size and you are good to go.for example:

$items['initialize/%/%/%/%/%'] = array(
    'page callback' => 'xmlproject_initialize_cf',
    'page arguments' => array(4, 5, 6, 7, 8),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
 );
Shirin Abdolahi
  • 1,047
  • 8
  • 18