Re: [SMARTY] caching question
| From: | M Mohr | Date: | Thu, 06 Feb 2003 10:19:02 +0000 |
| Subject: | Re: [SMARTY] caching question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7547@lists.php.net to get a copy of this message | ||
Hello,
On Thu, Feb 06, 2003 at 10:09:18AM +0100, philippe.morange@ca-indosuez.com wrote:
> Hi,
> Let's say I have this piece of code:
> I do caching on main.tpl, but I time the creation of the page, so I want the calculation not to
> be
> cached...
> I compute the time in PHP, then assign the time to the template.
>
> main.php
> -------------------------------------------------------------
> function insert_display_value($out) {
> return $out['out'];
> }
>
> $smarty_svg->assign('timer', $timer->getTime());
> ...
>
>
> main.tpl
> -------------------------------------------------------------
> <!-- This image was created in {insert name="display_value" out=$timer} seconds
> -->
>
>
> The problem is that in main.tpl, the $timer variable will be cached, so the function always
> returns the same value...
don't assign it a a template variable. assign it to a global variable, and
return that global variable from your insert function.
HTH
messju
> ==========================================================
> Ce message et ses pièces jointes (le "message") est destiné à l'usage
> exclusif de son destinataire.
> Si vous recevez ce message par erreur, merci d'en aviser immédiatement
> l'expéditeur et de le
> détruire ensuite. Le présent message pouvant être altéré à notre insu, Crédit
> Agricole Indosuez
> ne peut pas être engagé par son contenu. Tous droits réservés.
>
> This message and/or any attachments (the "message") is intended for the sole use of
> its adressee.
> If you are not the adressee, please immediately notify the sender and then destroy the message.
> As
> this message and/or any attachments may have been altered without our knowledge, its content
> is
> not legally binding on Crédit Agricole Indosuez. All rights reserved.
> ==========================================================
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Personal Firewall: Windows-Ganzkörper-Kondom.
Rainer Weikusat