Re: Caching for portals?

From: Date: Mon, 15 Apr 2002 20:25:12 +0000
Subject: Re: Caching for portals?
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3753@lists.php.net to get a copy of this message
"Michal Prinke" <bogien@conecto.pl> schrieb: > That's what I meant... I don't think that moving caching logic back to the > PHP script is a good idea - it really should be done in the template itself, > not to bother the person who writes db queries etc. > > The way to cache sub-templates which I present below should work, yes, > but it's rather ugly, you must agree: [... some ugly coding...] Yes, THIS was real ugly :-). You just have to switch off the cache after fetching the cached templates. index.php: ---------- $smarty -> caching = 1; // these sub-templates are pulled from the cache... $header = $smarty->fetch('header.tpl'); $footer = $smarty->fetch('footer.tpl'); $smarty -> caching = 0; // ...and this are is db-dependent $news = $smarty->fetch('news.tpl'); $poll = $smarty->fetch('poll.tpl'); // building the final document $smarty->assign(array( "header"=>$header, "footer"=>$footer, "news" =>$news, "pool" =>$pool )); $smarty->display('index.tpl'); // "ugly" was yesterday... Regards, Norbert

« previous php.smarty.general (#3753) next »