Generate cache with an array as identifier
| From: | Jacques Jocelyn | Date: | Thu, 20 Mar 2003 19:00:07 +0000 |
| Subject: | Generate cache with an array as identifier | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8787@lists.php.net to get a copy of this message | ||
Hello all,
I am implementing smarty in an existing application and I have some
difficulties with the cache.
when I have to generate the cache for a single variable, I use the
following :
if(!$tpl->is_cached("mytemplate.tpl","mypage|$myvar|$myvar2"){
// database query for my two variables $myvar & $myvar2
// assign smarty variables
// ..
}
Now my variables are arrays.
it's coming from an html form with the attributes :
<select name="myvar[]" multiple>
<option value=1>text1</option>
<option value=2>text2</option>
<option value=3>text3</option>
</select>
The select fields might contain 3 value or 20. this is dynamic
coming from a Dabatase.
here is my question How can I generate the cache
if I use the following
if(!$tpl->is_cached("mytemplate.tpl","mypage|$myvar|$myvar2"){
....
}
the cache system creates several sub directories but does not take the
arrays values
here is what I have in the cache structure
/home/website/cache/Array/Array/mytemplate....
Please advise.
Best regards,
Jacques