Re: [SMARTY-GENERAL] smarty templates caching.
| From: | Andrei Zmievski | Date: | Fri, 05 Apr 2002 14:24:07 +0000 |
| Subject: | Re: [SMARTY-GENERAL] smarty templates caching. | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3518@lists.php.net to get a copy of this message | ||
On Fri, 05 Apr 2002, Luc Saint-Elie wrote:
> If you want to place a template file called "mytemplate.tpl" inside another
> template you just need to write in the main template
> {include file="file:/home/foo/www/templates/mytemplate.tpl"}
> or
> {include file="mytemplate.tpl"}
>
> This is different if you want to cache the result, because the content of
> mytemplate.tpl must be evaluated before been cached (what is cached is the
> resulting HTML content)
>
> So you will do :
>
> $smarty->caching = true;
> if(!$smarty->is_cached('file:/home/foo/www/templates/mytemplate.tpl',
> $REQUEST_URI)) {
>
> $smarty->assign('center',$smarty->fetch('file:/home/foo/www/templates/mytemplate.tpl',
>
> $REQUEST_URI));
> $smarty->caching = false;
>
> and write in the main template
>
> {$center}
There is no difference between these methods if you use
display('main.tpl', $REQUEST_URI) for displaying it..
-Andrei
"Then again, E=mc^2 may only be a local phenomenon."
-- Einstein