Re: [SMARTY] Use of multiple caches per page.
Mark Rogers <[email protected]> Thu, 04 May 2006 15:41:24 +0100
| Newsgroups | gmane.comp.php.smarty.general |
|---|---|
| Organization | More Solutions Ltd |
| Message-ID | <[email protected]> |
boots wrote: > --- "Tony K." <[email protected]> wrote: > >> I want to be able to cache various pages, all called index.php but >> have various GET parameters for example like... >> >> index.php?a=1 >> >> index.php?a=2&b=3 >> >> index.php?a=1&b=2&c=4 >> >> Can I store these the strings of GET parameters as the cache_id's to >> cache the various permutations of pages? (something like... cache_id = >> "a=1&b=2&c=4") >> > > Sure: http://smarty.php.net/manual/en/caching.multiple.caches.php > It's worth remembering that index.php?a=2&b=3 is the same page as index.php?b=3&a=2 and may also be the same as index.php?b=3&a=2&c=1 .. if c defaults to 1 in your code, but they'll all be cached separately by this method. This may not matter to you, of-course, but if it does a more sophisticated (application specific) cache ID generator is needed. We parse all passed parameters into a "$params" array which also includes default values; we then ksort, serialize and hash the result to get an ID. -- Mark Rogers More Solutions Ltd :: 0845 45 89 555