For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > August 2004 > Caching attributes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Caching attributes
Martin Kjeldsen

2004-08-21, 4:03 pm

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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com