Re:Re:[BEGINNER] Question about caching

From: Date: Fri, 28 Dec 2001 20:53:40 +0000
Subject: Re:Re:[BEGINNER] Question about caching
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2416@lists.php.net to get a copy of this message
>> The whole method seems to break as soon as you start using ->fetch(), though. > >What do you mean? Any short examples? I've posted 3 examples previously on this list. When I have an outer 'main.tpl' and then the content is handled by inner ->fetch() calls, the caching gets confused and simply doesn't work. It keeps returning the same content, no matter what 'cache_id' I pass. I think the problem lies in the fact that at the end of EVERY page, I've got $tpl->display('main.tpl') - so the thing always caches in the same place, no matter what. If I pass a $REQUEST_URI, it caches the outer template correctly, but not the inner template. If I pass a $REQUEST_URI to my ->fetch('index.tpl'), it seems to CACHE the content correctly (I can view it if I go to the right dir or use the display function on THAT template), but it doesn't get outputted when I do->display('main.tpl'). That just displays whatever one got cached last time. ----- Original Message ----- From: Andrei Zmievski <andrei@ispi.net> To: "Brian E. Lozier" <brian@massassi.net> Date: 12/28/01 6:06:14 AM > >On Fri, 28 Dec 2001, Brian E. Lozier wrote: >> 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. > >What do you mean? Any short examples? > >-Andrei > >"Everything has its wonders, even darkness and silence, and I learn, > whatever state I may be in, therein to be content." - Helen Keller

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