Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi everyone and thanks - I'll make this short,
I'm using a fresh install of Drupal 6.1 with few modules (as i will list below). I made a function in template.php which returns a string:
<?php
function signature() {
return '<div id="signature"><script type="text/javascript">
var so = new SWFObject("files/swf/sig.swf", "mymovie", "190", "57", "8", "#000000");
so.addParam("quality", "high");
so.addParam("wmode", "transparent");
so.addParam("menu", "false");
so.write("signature");
</script></div>';
} ?>
When I call that function...
<?php print signature(); ?>
...and display the page logged in as USER #1, everything is normal. HOWEVER, when not logged in as user #1 the page stops parsing and displays...
Fatal error: Call to undefined function signature() in C:\wamp\www\activize\includes\common.inc(1537) : eval()'d code on line 19
...which is a headache.
Any suggestions as to what this may be?
Comments
Comment #1
dmitrig01 CreditAttribution: dmitrig01 commentedThere is a high likelyhood that the code is being called before template.php is included. Try making a module, enabling it, and putting the function in that module.
And, this is DEFINATELY not critical.
Comment #2
bensnyder CreditAttribution: bensnyder commentedSorry 'bout that dmitrig01,
Thanks for your response! I think functions defined in template.php are definitely called before files like page.tpl.php however as per my experience you cannot use those functions if embedding php in a node.
What'cha think? Anyone else have a workaround for this issue? Possibly a module that implements require_once ('.../template.php'); at the "front of the line"?
Comment #3
avior CreditAttribution: avior commentedHi
I have this issue too, i am trying to call template.php function from a node
this worked sometimes , but sometimes fails with the message "Call to undefined function"
Any ideas ?