Caching particular parts of a page
| From: | Oleg Krogius | Date: | Mon, 30 Sep 2002 19:57:35 +0000 |
| Subject: | Caching particular parts of a page | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6055@lists.php.net to get a copy of this message | ||
Hi,
I have a page that's cached by smarty. Here's a bare bone example of the
total thing that gets cached:
header...
{$nav}
blah blah
{$abc}
blah blah
{$content}
footer...
I want everything in that template to be cached but one variable (user
login/logout box) - $abc in above example.
What's the best approach for me to take doing this? Currently I've been
thinking about something along these lines...
//all init code
$t->caching=1;
$t->assign($nav,'pages...');
$t->caching=0;
$t->assign($abc,$t->fecth('loginbox'));
$t->caching=1;
$t->assign($content,'text');
$t->display('main');
..but how effecient would that be? Is there a better approach?
Thanks for your time,
Oleg Krogius.