I am using garland template

I have a function mymodule_result that is called directly via a menu
function mymodule_result() {
//some code
return _phptemplate_callback('mymodule_result_page', $vars);
}

I have defined a template file called mymodule_result_page.tpl.php in the garland folder

however I am getting an error

Call to undefined function: _phptemplate_callback()

What is the best to reference a template file from a module without using node or blocks?

Thanks
mark

Comments

vm’s picture

It's gonna help if you tag or mention the version of Drupal you are using. 5.x and 6.x are different in these types of areas.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

mark7’s picture

I am using drupal 5.7.

I also can see the function _phptemplate_callback is defined under
themes/engines/phptemplate/phptemplate.engine.

which means this file is not getting loaded

mark7’s picture

anyone there?

vm’s picture

http://api.drupal.org/api/function/_phptemplate_callback/5

may help

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

jmlavarenne’s picture

I am having a similar issue with 5.10

I am writing a little module and depending where in my .module file I use _phptemplate_callback() I either get the result I expect (file gets processed) or a Call to undefined function _phptemplate_callback() error page.

What I've come up with as an explanation is :

if I use phptemplate_callback after having called the theme() function (for another reason altogether) the function exists.

if I try to use phptemplate_callback before, it is undefined.

jmlavarenne’s picture

I've solved this as follows.

In my template.php file I declared the following function :

function theme_fake()
{
  return;
}

Whenever I wan't _phptemplate_callback() to be accessible for my module, I start the module with a call to this function

theme('fake'); 

after which _phptemplate_callback is available for my module.

I supposed this is caused by the order in which the Drupal boostrap process takes place. By it's name, the function is a helper function, so I suppose it was never ment to be used the way I want to use it (but it's so useful...).

Can't wait to have my projects move to Drupal 6 - I guess all these custom modules will require a fair bit of updating...

rgrocha’s picture

To use any function defined elsewere in Drupal I just include the file where its defined, whatever it's a module, theme or engine.
To use the _phptemplate_callback I just use

	$phptemplate_engine_path = drupal_get_path('theme_engine', 'phptemplate');
	require_once("$phptemplate_engine_path/phptemplate.engine");

	_phptemplate_callback(....)