Re: [SMARTY] Caching for portals?
| From: | Norbert Röcher | Date: | Sun, 14 Apr 2002 22:59:57 +0000 |
| Subject: | Re: [SMARTY] Caching for portals? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3717@lists.php.net to get a copy of this message | ||
"Michal Prinke" <bogien@conecto.pl> schrieb:
> > You could clear cached file after a change of your contents.
>
> Hmmm... I would have to store and check all the template variables
which
> were used to build every cached page.
What? Nonsens...
> I think it would be ineffective,
> besides, talking about portals, they change from second to second...
You just have to check, which templates are affected by a change of
your database. For example, if you add a link to a linklist you just
have to clear the cache of the affected subtemplate.
> > "Include" keeps up dynamic inserts and its output gets cached
within
> > the including template.
>
> So it means that you cannot cache included sub-templates separetely,
> because they get cached within the topmost template, called from the
PHP
> script by $smarty->display() or $smarty->fetch()?
Correct. A workaround is to {insert} fetched templates. But this could
cause problems while handling these fetched templates within a loop. A
cached file would "think" like this: "Aha, my header says i contain 3
inserts. So i just do these 3 inserts and don't care about anything
else, even if i got more informations to insert".
An {insert_section} or {nocache}...{/nocache} would help to solve this
problem... but these don't exist. :-)
> > If you don't use inserts just fetch the block and put it to it's
> > location in the upper template. "Fetch" makes use of caching its
output,
> > but doesn't allow inserts when you put the output into an upper
template.
>
> But fetch does not interpret Smarty language, just fetches the file
> from the filesystem "as is"... or maybe I am wrong?
Sorry, you're wrong. "Fetch" does the same as "display" and processes
the full template or get's the cache, just without echoing the output.
"Display" in smarty.class.php does nothing else than calling the
"fetch"-routine with some special params to echo the results.
> Brad Atkins wrote:
> > To be most flexible, I think that both the nocache and insert calls
> > should be valid. As in some cases, yes, the insert and the use of
> > a seperate template is necessary (banner ads).
>
> 100% agree. This would be the best solution.
Another 100% from here... ;-)
Norbert