Re:[BEGINNER] Question about caching

From: Date: Fri, 28 Dec 2001 11:43:24 +0000
Subject: Re:[BEGINNER] Question about caching
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2399@lists.php.net to get a copy of this message
If you're using exactly one template per page, you just use this: $tpl->display('yourtemplate.tpl', $REQUEST_URI); And it will display the cached page. But remember you need to go back and test to see if it's cached before performing all your db calls, action, etc. So you need: if(!$tpl->is_cached('yourtemplate.tpl', $REQUEST_URI)) { // do all your page logic here } $tpl->display('yourtemplate.tpl', $REQUEST_URI); The whole method seems to break as soon as you start using ->fetch(), though. Brian ------------------------------------ "How should I know if it works? That's what beta testers are for. I only coded it." - Linus Torvalds ----- Original Message ----- From: Luc Saint-Elie <luc@saint-elie.com> To: smarty@lists.ispi.net Date: 12/28/01 3:01:36 AM > >Hello, > >I'm very late to the cache function because my ISP didn't provide access to >mkdir().. and whaoo (thanks Santa!) he now has opened it. > >So it my first glance at $smarty->caching = true.. therefore this stupid >question. > >If I set caching to true the first page is cached then the links (internal >links) doesn't work anymore and each click reload the same page. > >In case this is of any importance, my web site uses very few *.php files >and a lot of URL variables >I mean I have a index.php and each page is accessed through >Index.php?op=a >Index>.php?op=b >Index.php?op=c and so on > >In case this is of any importance too here is the begenning of my *.php files : >================ ><?php >session_start(); >/***************************************************/ >/* Smarty Template / >/***************************************************/ >require("Smarty.class.php"); >$smarty = new Smarty; >$smarty->compile_check = false; >$smarty->debugging = false; >$smarty->caching = false; => if set to true I've no more navigation >================== > >Thanks in advance > >Luc > > >--- >You are currently subscribed to smarty as: brian@massassi.net >To unsubscribe send a blank email to $subst('Email.Unsub') >Visit Smarty's homepage at >http://www.phpinsider.com/php/code/Smarty/

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