resource function not working properly
| From: | Peter Bowyer | Date: | Tue, 05 Feb 2002 12:29:57 +0000 |
| Subject: | resource function not working properly | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2643@lists.php.net to get a copy of this message | ||
Hi,
I've spent the morning trying to get this to work, to no avail :-(
I have the following function:
function smarty_resource_string($tpl_name, &$tpl_source, &$tpl_timestamp, $get_source = true, &$smarty)
{
$tpl_source = $GLOBALS[$tpl_name];
// echo "Function works! ::<br>$GLOBALS[$tpl_name]";
$tpl_timestamp = mktime();
} // End smarty_resource_string
That is registered like this:
$smarty->register_resource("string","smarty_resource_string");
and called in my code like:
$article = $row['article'];
$smarty->assign( 'article', $smarty->fetch('string:article') );
However, it produces this error.
Warning: Smarty error: unable to read template resource: "string:article" in /usr/local/lib/php/Smarty/Smarty.class.php on line 1518
If I put an echo inside the function then it's definitely being called, and so I know that it should be working.
What's the problem?
Peter.
--
Devon Railway Centre - a great day out!
http://www.devonrailwaycentre.co.uk