[support] template.php function called from a php block
Dany V.
danyv at focusweb.ca
Fri Oct 5 19:10:55 UTC 2007
I wrote a very basic function in template.php. When I edit a page and
switch the input format to PHP, the preview works fine and I see the
result of the function call. However, when I save the page, I get:
Fatal error: Call to undefined function: phptemplate_1()
in .../includes/common.inc(1342) : eval()'d code on line 32
This is my test function in template.php:
function phptemplate_1() {
$output = '<h1>Doh!</h1>';
return $output;
}
And there is only this on my page:
<?php
print phptemplate_1();
?>
If I write the function in node.tpl.php, it works. If I write the code
in a page and preview it, it works. When I save the page, it doesn't.
I'm pretty sure this is a newbie mistake, include missing maybe? I've
been reading about it, browsing but I couldn't find anything specific.
Any pointers?
Thanks.
--
Dany V.
More information about the support
mailing list