Re: [SMARTY] Multiple $_GET
| From: | Daniel Cummings | Date: | Thu, 18 Dec 2003 23:38:25 +0000 |
| Subject: | Re: [SMARTY] Multiple $_GET | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10723@lists.php.net to get a copy of this message | ||
You could also do it this way. more cumbersome than monte's method of md5
the entire request, but lets you control what is going into the cache
definiton.
-----------
$which_group=$_GET['group'];
$which_page=$_GET['page'];
// store a unique cache_id for smarty to
// tell the difference between the multiple
// pages served through index.tpl
$which_group_padded = substr("0000$which_group",-4);
$which_page_padded = substr("0000$which_page",-4);
// use the dot to concatenate the zero padded strings
$cache_id = $which_group_padded . $which_page_padded;
//print_r ($cache_id);
if(!$smarty->is_cached('index.tpl', $cache_id))
{
//do your database access here
}
------------
I also use this little trick to allow ad hoc cache refreshing during
development:
if ($_GET['cache']=="off")
{
$smarty->clear_cache("index.tpl",$cache_id);
}
put this code before the is_cached() call so you can send a url like the
following and force the cache to refresh on a page by page basis:
www.photos.com?cid=1&photo=3&cache=off
cheers,
dan
On 12/18/03 5:26 PM, "UpFront Technology" <upfronttechnology@rrohio.com>
wrote:
> Hello,
>
> I know that smarty can handle caching of a single $_GET parameter, but can
> it handle MULTIPLE from the same URL?
>
> ex. www.photos.com?cid=1$photo=3
>
>
> thanks
> Joe