Re: [SMARTY] Caching for portals?
| From: | Michal Prinke | Date: | Sun, 14 Apr 2002 21:15:07 +0000 |
| Subject: | Re: [SMARTY] Caching for portals? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3713@lists.php.net to get a copy of this message | ||
Linus McCabe wrote:
> You can use the insert function to include parts of uncached data in
> cached content. You can also turn on and off cache for different
> display() or fetch() calls.
Inserts require writing separate functions for each uncached part:
{insert name="getPollYes"} people voted "YES"
{insert name="getPollNo"} people voted "NO"
blah blah blah
Today is {insert name="getCurrentDate"}
blah blah blah
...and this could make your project very complicated.
Norbert Rocher wrote:
> 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. I think it would be ineffective,
besides, talking about portals, they change from second to second...
> "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()?
> 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?
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.