Caching attributes
| From: | Martin Kjeldsen | Date: | Sat, 21 Aug 2004 13:03:36 +0000 |
| Subject: | Caching attributes | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11711@lists.php.net to get a copy of this message | ||
Hi,
I have some problems with caching attributes. I've registered a function
like this:
$GLOBALS['smarty']->register_function('recent_articles',
'do_recent_articles', false, array('article_id','category_id'));
When using the cache version of the script i get the following errors:
Warning: current() [function.current]: Passed variable is not an array or
object in smarty263\Smarty.class.php on line 1899
Warning: next() [function.next]: Passed variable is not an array or object
in smarty263\Smarty.class.php on line 1900
The error is easily fixed with a is_array() check before lines 1899-1900,
but that maybe break other stuff.
Another thing is that the cached version doesn't work because the function
doesn't get the required parameters ('article_id','category_id'). But if I
use the following instead
$GLOBALS['smarty']->register_function('recent_articles',
'do_recent_articles', false, array('article_id' => 1,'category_id'
=> 1));
The functions receives the correct values (not 1 and 1), but the PHP error
is still there.
Any ideas? Is this a bug?
Cheers
Martin