Re: [SMARTY-DEV] var renaming, speed testing and no-cache
| From: | messju mohr | Date: | Sat, 21 Jun 2003 09:52:07 +0000 |
| Subject: | Re: [SMARTY-DEV] var renaming, speed testing and no-cache | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1651@lists.php.net to get a copy of this message | ||
On Fri, Jun 20, 2003 at 02:11:30PM -0700, boots wrote:
> Finally, messju, can you please give a few words regarding the no-cache
> changes that were added to the engine?
you can register a function as being not cacheable:
function foo($params, &$smarty) { echo md5(uniqid('foo')); }
$smarty->register_function('foo', 'foo', false);
the id changes on every reload of a page that contains {foo}, even if
caching is enabled. it's almost like using {insert}, the only
difference at the moment is the variable's scope of parameters passed
to foo(). with {insert} the parameters have the value they had when
the cached page was generated, with a not cacheable function, the
parameters are not cached but have the current values. i don't know
how i will handle the parameter's scope finally. this is work in
progress.
the functionality is achieved by generating a second file on
compilation that contains the not cacheable parts of a page as
php-functions. when a page is in the cache but contains not-cacheable
parts, only this compiled include-file needs to be loaded in addition
to the cached page, and the dynamic (=not cacheable) parts are merged
back into the output.
that's all about it. nothing more, nothing less.
greetings
messju