Re: [SMARTY] {nocache}
| From: | Monte Ohrt | Date: | Thu, 23 Jan 2003 21:40:09 +0000 |
| Subject: | Re: [SMARTY] {nocache} | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7320@lists.php.net to get a copy of this message | ||
Currently, {insert ...} is how it works. Yes its a bit tedious, cache
features are in the list of things to do.
You can make reusable wrappers to have your include files stay dynamic:
{insert name="include" file="header.tpl"}
Then write the include function to do what you want, which is basically
include and interpret the header.tpl file.
One day we may have something like:
{include file="header.tpl" cache=false}
Or, registering template files as non-cachable.
Monte
On Thu, 2003-01-23 at 15:20, Aliba Sora wrote:
> I have a header that is being added to some pages using the {include} tags.
>
> Inside this header is just a search box and graphic. I would like to also
> include a link to 'view shopping cart' only if the user has items in their
> cart, and a link to 'login and checkout' if the user hasn't already logged
> in.
>
> The question is, how do I keep that from becoming cached? I was looking
> forward to...
>
> {nocache}
> {if count($smarty.session.cart.items) > 0}
> cart link here
> {/nocache}
>
> Right now with either the {php} or regular smarty logic, the content becomes
> calculated and converted to html after analyzing the cache dir.
>
> I am aware of insert but that seems like a lot of trouble for that little bit
> of code. Anyone have any suggestions? Maybe I'm missing the point of
> cacheing on this one :)
--
Monte Ohrt <monte@ispi.net>