I've create a module called finder that I want to take parameters from a url, crunch them and then display results via a tpl file. here's the relevant functions...
function finder_menu()
{
$items = array();
$items['finder'] = array(
'page callback' => 'finder_view',
'access callback' => TRUE,
);
return $items;
}
function finder_theme($existing, $type, $theme, $path)
{
return array(
'finder_view' => array(
'variables' => array('providers' => null),
'template' => 'results',
),
);
}
function finder_preprocess_finder_view(&$variables)
{
// put my data into $variables
}
function finder_view($zipcode = null)
{
// Get Providers from Zipcode
return theme('finder_view', $providers);
}
Now I know finder_view is being called. I also know finder_preprocess_finder_view is being called. Finally, I know that result.tpl.php is being used to output. But I cannot wrap my head around how to do meaningful work in the callback, somehow make that data available in the preprocessor to add to "variables" so that i can access in the tpl file.
in a situation where you are using a tpl file is the callback even useful for anything? I've done this in the past where the callback does all the work and passes to a theming function, but i want to use a file for output instead this time.
Thanks...
UPDATE: This was actually a parameter naming issue. Drupal 6 uses an 'arguments' key in hook_theme and not 'variables'. Once changed it all worked as expected. I removed the preprocessor also as my logic was being performed in the callback.
The problem existed in hook_theme where I used 'variables' instead of 'arguments'. Should I just delete this question?