Caching newbie questions
| From: | pt2002 | Date: | Fri, 04 Apr 2003 11:36:43 +0000 |
| Subject: | Caching newbie questions | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9084@lists.php.net to get a copy of this message | ||
Hello
I've start using Smarty cache features and I've followed the examples from
the manual
Example:
index.php
$templ = new Smarty();
if (!is_cached("index.tpl") {
db code; db code;
assign code; assign code;
}
$templ->display("index.tpl");
==========================================
index.tpl
{include file="header.tpl"}
{include file="left_nav_bar.tpl"}
body content
{include file="footer.tpl}
So far so good.
Been reading some posts, I've see something like using several template but
don't cache them all.
Supose I don't want to cache left_nav_bar.tpl. I know the {insert} feature
but it's not what I really want.
Do I need to create a Smarty object for each template and se cache = false
for left_nav_bar.tpl ? Something like this ?
$header = new Smarty(); // cache = true
$left_nav_bar = new Smarty(); // cache = false
$index = new Smarty(); // cache = true
$footer = new Smarty(); // cache = true
assign code here
$header->display("header.tpl");
$left_nav_bar->display("left_nav_bar.tpl");
$index->display("index.tpl");
$footer->display("footer.tpl")
=====================================================
Thanks in advance
Best regards
pt2002