I have a hook_menu like that:
function mymodule_menu() {
$items['mymodule-test'] = array(
'page callback' => '_mymodule_test_callback',
'access callback' => TRUE
);
return $items;
}
and the callback function:
function _mymodule_test_callback()
{
// processing
return $html;
}
I googled around but i cant find how to force the page template inside my _mymodule_test_callback function.
Edit: why i cant (or dont feel comfortable with) url-based suggestion
Url-based suggestion are easy to implement, however they can not completely fit my needs.
The template I have to use is determined in the _mymodule_test_callback function, according to very various aspects, for example:
- Does exists a node of type 'foo', and does the field 'abc' value's be 'xyx'? => choose template 'page-mymodule-foo.tpl.php'
- The node does exists, but the field 'abc' value is empty? => Choose temlate 'page-mymodule-bar.tpl.php'
- The node does not exist at all, but the user has the 'bimbumbam' role? => Choose template 'page-mymodule-foobarz.tpl.php'
...and so on.
I know this is a rare behavior, and that i could redirect instead of switching template, but actually the function body is not big and i prefer to do this way.
Is not possible?