Re: [SMARTY] Caching and insert
| From: | messju mohr | Date: | Tue, 10 Feb 2004 09:18:07 +0000 |
| Subject: | Re: [SMARTY] Caching and insert | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10940@lists.php.net to get a copy of this message | ||
On Mon, Feb 09, 2004 at 07:01:57PM -0800, Vonleigh Simmons wrote:
> Hello,
>
> I have a section of the site that I want to insert so that it isn't
> cached; basically a login panel that either greets you if you're logged
> in, or displays the typical login/password box.
>
> Anyway, I have a template called login.tpl, but I can't seem to
> display it. It would seem that I would need an additional smarty object
> to be able to call smarty->display(login.tpl). Two questions:
>
> 1. Do you know of a way I can do this without creating an additional
> smarty object?
Use the one that is passed to the insert-function:
function smarty_insert_include($params, &$smarty) {
$caching = $smarty->caching;
$smarty->caching = false;
$output = $smarty->fetch($params['file']);
$smarty->caching = $caching;
return $output;
}
> 2. Is there a way of inserting a template directly without the need to
> call a function? I need to insert it instead of including it so that
> does not get cached with the rest of the page.
No, you need an insert-function or a registered function that is
explicitely registered as not-cacheable..
> ---
> Additionally I haven't received any responses from my earlier
> question, I hope that it's not because it's too basic or in the docs.
> If I have a page that shouldn't be cached at all, what's the best way
> of going about it if I already declared caching = 2 in the constructor
> of my child-of-smarty object?
>
>
> Vonleigh Simmons [vanlei]
> San Francisco, CA
> <www.illusionart.com/pi/>