views:

503

answers:

1

I've build a page using a custom module, and given it a nice url such as /sage/notify, and using the hook_menu set it to run my function to handle that page.

All was working great until I tried to pass a querystring variable into the page /sage/notify?test=true

At this point I was told that the page can't be found.

Does anyone know away around this I'm trying to get Sage Pay to pass variables through to that web address?

Cheers

Matt

+1  A: 

I'm not sure how you are declaring your menu item in hook_menu, but here is a sample that has worked for me in the past

function hook_menu(){    
  $items['sage/notify/%'] = array(
    'title' => 'Page Title',
    'page callback' => 'my_custom_function',
    'page arguments' => array(1), 
    'type' => MENU_CALLBACK,
    'access callback' => TRUE,
  );
  return $items;
}

In this example the path to the page I want to access is sage/notify/%. The percent sign is what allows you to pass variables to your function that handles that page, along with the page arguments key.

So your custom function could look something like this:

function my_custom_function($variable) {
  //Code to handle the variable passed in from the URL
}
quickcel
Thanks quickcel, will try it
Matt
Worked like a charm, thanks a lot I just went for 'path' => 'sage/notify%',and this did it.
Matt
good to hear ;)
quickcel