Re: Caching for portals?
| From: | Norbert Röcher | Date: | Sun, 14 Apr 2002 17:31:31 +0000 |
| Subject: | Re: Caching for portals? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3705@lists.php.net to get a copy of this message | ||
"Michal Prinke" <bogien@conecto.pl> schrieb im Newsbeitrag
news:3CB98D7B.9A7CB1FD@conecto.pl...
> Hello,
>
> I am working on some web portal and I've decided to use Smarty as the
template
> engine.
>
> Now I am wondering if Smarty's caching mechanism can be of any use
for me? 99%
> of my PHP scripts pull records from the database on every call (news,
poll
> results, no of users online), and they will change very frequently...
if cache
> does not regenerate on change of any single template variable, it is
useless
> for such kind of projects... isn't it?
I don't think so. You could clear cached file after a change of your
contents. Or you could do {insert}s for dynamic blocks with always the
same count of entries. And and and...
> But I've read there is a possibility to cache only SOME PARTS of
templates.
> How to do it? Does it mean that I can cache e.g. some static
sub-template
> included via Smarty's {include file="header_with_logo.tpl"} but not
by PHP's
> $smarty->display('index.tpl') ???
Your friends are named "include" and "fetch". There are several ways to
do what you want. Depends to your app. "Include" keeps up dynamic
inserts and its output gets cached within the including template. 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.
Generally it's this simple: "If Smarty can't do it, no template else
can do it". ;-)
Norbert