RE: Please help on caching

From: Date: Thu, 27 Dec 2001 14:43:27 +0000
Subject: RE: Please help on caching
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2389@lists.php.net to get a copy of this message
oops, forgot the ! ;)))) > You would want that the other way around btw... > > if !$smarty->is_cached('main.tpl', $HTTP_GET_VARS['catid']) > { > // database calls > } > > LIMBOURG Arnaud wrote: > > > > if $smarty->is_cached('main.tpl', $HTTP_GET_VARS['catid']) > > { > > // database calls > > } > > > > $smarty->display('main.tpl', $HTTP_GET_VARS['catid']); > > > > doesn' it do what you want ?? > > > > > I'm very frustrated right now because I can't get the caching > > > to function correctly. I have a page called > > > 'files.php' which is designed to list all files under a > > > certain 'category.' These files and categories are > > > stored in a database. Here is a small example of the > category table. > > > > > > catID > > > catName > > > catParent > > > > > > This way I can have infinitely nested categories. So, if I > > > want to view a specific category, I just view the > > > page and pass a $catID in. > > > > > > files.php?catID=5 > > > > > > Say this lists "Windows Text Editors." > > > > > > It defaults to '0' if no catID is passed correctly which will > > > list just root categories. > > > > > > Now here is the problem. The cached results are ALWAYS the > > > same as the very first access to the files.php > > > page. So, if I access files.php?catID=5, it caches the > > > results correctly for that catID (all the "Windows > > > Text Editors"). The problem is, after that, if I pass > > > another catID, I get the original cached results from > > > $catID = 5 (Windows Text Editors). > > > > > > I have queried this list quite a few times but nothing is > > > helping. I upgraded to the latest version. I have > > > tried all suggestions. Is this a bug in Smarty? Does anyone > > > else have this "dynamic" content caching > > > correctly using the cache_id? Because Smarty is just > > > ignoring my cache_id I pass, no matter what it is. > > > Please, I really need to get this working, it's important. > > > > > > Here is my 'main.tpl' which is the main layout of the site > > > (note I replaced > and < with ] and [ because my > > > email program strips the HTML for some reason): > > > > > > main.tpl: > > > [html] > > > [head][title]{$PageTitle}[/title][/head] > > > [body] > > > {$Content} > > > [/body] > > > [/html] > > > > > > Then, my files.php functions like this: > > > $tpl = new Smarty; > > > // get all my db stuff into a few arrays > > > // Assign all to Smarty like: > > > $tpl->assign("Categories", $categories); > > > $tpl->assign("Files", $files); > > > > > > // Then I include the specific template for the specific page > > > I'm working on: > > > $tpl->assign("Content", $tpl->fetch('files.tpl')); > > > > > > // Then I display it > > > $tpl->display('main.tpl'); > > > > > > I have tried passing both $REQUEST_URI (which *is* passing > > > correctly, I verified!) and $catID (since it's > > > unique for each of the cache results I'm looking for) to > > > main.tpl like: > > > $tpl->display('main.tpl', $REQUEST_URI); // and: > > > $tpl->display('main.tpl', $catID); > > > > > > I've also tried passing it to the $tpl->fetch() where I get > > > the actual files.tpl template like: > > > $tpl->assign("Content", $tpl->fetch('files.tpl', > > > $REQUEST_URI)); > > > $tpl->assign("Content", $tpl->fetch('files.tpl', $catID)); > > > > > > But it never caches any differently, no matter what. Please, > > > I really need some help. Thanks in advance. > > > > > > Brian > > > > > > > > > --- > > > You are currently subscribed to smarty as: > arnaud.limbourg@cegetel.fr > > > To unsubscribe send a blank email to > > > $subst('Email.Unsub') > > > Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/ > > > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/çN > _t1ª†´2Ñz4M -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/ --- You are currently subscribed to smarty as: arnaud.limbourg@cegetel.fr 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 (#2389) next »