Re: [SMARTY] question about the dynamic %% directory in C:\
| From: | Jason Jones | Date: | Wed, 08 Jan 2003 21:30:12 +0000 |
| Subject: | Re: [SMARTY] question about the dynamic %% directory in C:\ | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7064@lists.php.net to get a copy of this message | ||
Hoffman, Geoffrey wrote:
Thanks to Nichlas and Monte, my cache now works perfectly with one get param. Next question is, the user is going to view a section page (index.php?sec=1, sec=2, etc) which generates a summary of news items. they click on 'read more' for a story summary and get a link like index.php?sec=1sty=4. should I just call that cache_id 14, meaning, do ->display('index.tpl', $_GET['sec'].$_GET['sty']) ? in theory that will cache both the summary page for a section, and the story detail pages? I supposed I could use a new (mostly copied) detail.php/detail.tpl and cache_id $_GET['sty'] - what do you think? Thanks again- GeoffRegards, Jason Jones jason@tekscode.com-----Original Message----- From: Nichlas Löfdahl [mailto:crotalus@acc.umu.se] Sent: Wednesday, January 08, 2003 12:07 PM To: Hoffman, Geoffrey; Smarty (E-mail) Subject: Re: [SMARTY] question about the dynamic %% directory in C:\ Hello! Try something like this: $smarty->display('yourtemplate.ihtml', $_GET['sec']); (but you should probably check $_GET['sec'] for proper values etc.). Read more about caching here: http://smarty.php.net/manual/en/caching.php http://smarty.php.net/manual/en/api.display.php /Nichlas ----- Original Message ----- From: "Hoffman, Geoffrey" <ghoffman@aztrib.com> To: "Smarty (E-mail)" <smarty-general@lists.php.net> Sent: Wednesday, January 08, 2003 7:58 PM Subject: [SMARTY] question about the dynamic %% directory in C:\I'm not sure if this would work for you, but here's a suggestion: perhaps instead of using a paramter on one master script to pick out the section (like ?section=3), another approach might be to just have a sports.php page and a page for all the main sections, and then have whichever common functions you need in a separate library file. If I understand correctly, you might even get slightly better performance. But, each case is different.I have started putting some dynamic SQL stuff intoindex.php in my firstSmarty project. I have news stories in different sections, i want index.php?sec=1 to be 'news' stories, ?sec=2 to be sportsstories, etc.What I have so far will work (e.g. the stories show upunder the givensection) but only if I trash the cache folder _after eachget_ . In otherwords, my get param is only recognized if there's no cache;once the cacheis created (for sec=2 or sports stories) all subsequent requests of index.php?get=anything gives me sports stories. If I trash the %%directoryin C:\ then I can do sec=1 and get main section stories,but then it's'frozen' in main section. i want to take advantage of caching where possible, butwhat code (andwhere) should i use to refresh using the value ($_GET) passed toindex.php?