AW: Re: Please help on caching
| From: | Werner Schweizer | Date: | Sun, 30 Dec 2001 11:24:45 +0000 |
| Subject: | AW: Re: Please help on caching | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2444@lists.php.net to get a copy of this message | ||
As you certainly noticed, my previous example had errors.
Here the correct version:
in xx.php
---------
$template = "whatever.tpl"; // .tpl name depending of xx.php or
$REQUEST_URI
$smarty->assign("template",$template);
$smarty->assign("contents",$contents); // $contents filled by xx.php
$smarty->display('main.tpl', $template . $REQUEST_URI);
main.tpl
--------
<html>
<body>
{if !empty($template)}
{include file=$template}
{else}
<h1>Error: No template specified</h1>
{/if}
</body>
</html>
This way the caching should work and has an unique id.
Maybe you don't nead both, $template and $REQUEST_URI
as cache id if your $template is a unique result of $REQUEST_URI.
Werner Schweizer