Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

v2.6.3, is_cached(), cache ID not accepted

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
till
Smarty Rookie


Joined: 25 Feb 2004
Posts: 19
Location: Berlin, Germany

PostPosted: Mon Aug 16, 2004 7:05 pm    Post subject: v2.6.3, is_cached(), cache ID not accepted Reply with quote

[php:1:f46f36092d]<?php
if(!$smarty->is_cached('archiv-threads.tpl', md5($_SERVER['QUERY_STRING']))){
...
}
$smarty->display(archiv-threads.tpl');
?>[/php:1:f46f36092d]

I thought this up to generate the IDs on the fly since I do have a lot lot different pages that get generated from this template. The QUERY_STRING is always unique, and for ease of use I wrapped it in md5().

I echo'ed them on the page and they actually do change. But the cached of the "first" page is always displayed.

Did I miss something?

Till
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Aug 16, 2004 7:11 pm    Post subject: Re: v2.6.3, is_cached(), cache ID not accepted Reply with quote

till wrote:
Did I miss something?


yes, you have to pass the cache_id to display() also:

[php:1:802312687a]<?php
if(!$smarty->is_cached('archiv-threads.tpl', md5($_SERVER['QUERY_STRING']))){
...
}
$smarty->display('archiv-threads.tpl', md5($_SERVER['QUERY_STRING']));
?>
[/php:1:802312687a]

and then maybe store the cache_id in a variable, to save one call to (the computionally expensive) md5().
Back to top
View user's profile Send private message Send e-mail Visit poster's website
till
Smarty Rookie


Joined: 25 Feb 2004
Posts: 19
Location: Berlin, Germany

PostPosted: Tue Aug 17, 2004 7:36 am    Post subject: Reply with quote

Ah, sorry. I feel very stupid. Sad
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP