Re: And one more :-)
| From: | Norbert Röcher | Date: | Fri, 12 Apr 2002 12:55:21 +0000 |
| Subject: | Re: And one more :-) | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3667@lists.php.net to get a copy of this message | ||
"Norbert röcher" <norbert.roecher@t-online.de> schrieb im Newsbeitrag
news:20020412131850.62452.qmail@pb1.pair.com...
>
> "Norbert röcher" <norbert.roecher@t-online.de> schrieb im Newsbeitrag
> news:20020412125727.39027.qmail@pb1.pair.com...
> > Included templates are compiled as separate files. Is there a
reason
> > why these files are not also written as cached files? However, this
> > will need an additional, defineable parameter to the
inlcude-function
> > as identifier for the cached file.
>
> BTW: A great functionallity would be to optionally set a separated
> cache_lifetime for each inluded file, which is set as
expire-timestamp
> within the cached included file. Any include should then first check
> for a cached file.
>
> In addition the include-tag could be compiled as an {include on
> expire}-function in the cached upper template. If the expiring time
of
The {include on expire} should be handeled by an {insert function}, not
as
separated tag.
Stupid Pseudo-Code:
In (cached) Template:
{insert name=includeTemplate file=$tplname id=$tplid
expires=$expire_timestamp}
Insert_Function:
smarty_insert_includeTemplate()
{
if (is_cached($tplname, $tplid)){
include $cached_file;
} else {
include $compiled_file;
}
function is_cached(){
if (file_exists($cached_file) && $cached_file['expire_timestamp'] >
time()){
return true;
}
return false;
}
Regards,
Norbert