Hi,
I'm starting a development of a module who's primary purpose is to query a web service. For one particular page the goal is quite simple, call the web service with a particular item id and display the results on a page. I'm using hook menu to call an auto-load function with the ID from the URL. The problem I have is that the _load function is called multiple times per page request.
All works well otherwise and the page callback function is only called once. Can anyone explain why the page callback is called multiple times. Its obviously an issue for me as the calls to the remote web service are relatively expensive. I can cache if I need to, but would prefer to keep it simple.
The relevant code:
function matchpoint_menu() {
$items['testpages/%testpage_show'] = array(
'title' => t('Matchpoint Events'),
'page callback' => 'testpage_page_view',
'page arguments' => array(1),
'access arguments' => array('administer site'),
'file' => 'testpage.pages.inc',
);
return $items;
}
function testpage_show_load($id) {
dd('in testpage_show_load with id '.$id);
$ws = new TestWS_Query();
$res = $ws->getItem($id);
return $res;
}
:wq
Greg Frith
Comments
I have the same issue, my
I have the same issue, my loader function is called 4 times.
3 times before the callback, then the form is called, and then again 1 time for the loader function.
Here's my hook_menu :
I'm using Drupal 7.12
I opened an issue here :
I opened an issue here : http://drupal.org/node/1471554