caching

0 views
Skip to first unread message

Andras Kende

unread,
Nov 19, 2009, 8:43:10 PM11/19/09
to smarty-d...@googlegroups.com

Can you help me how to exclude the {$username} from being cached ?

index.php:
$smarty->caching = true;
$smarty->assign('name', $_SESSION['username']);

index.tpl:
Welcome {$username} !


Thanks,
Andras

Tom Fazakas

unread,
Nov 20, 2009, 4:42:35 AM11/20/09
to smarty-d...@googlegroups.com
try adding the $username between the {dynamic}...{/dynamic} tag.


2009/11/20 Andras Kende <and...@kende.com>:
> --
>
> You received this message because you are subscribed to the Google Groups "Smarty Developers" group.
> To post to this group, send email to smarty-d...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/smarty-developers?hl=.
>
>
>

Monte Ohrt

unread,
Nov 20, 2009, 9:20:04 AM11/20/09
to smarty-d...@googlegroups.com
Try:

Welcome {$username nocache} !


To unsubscribe from this group, send email to smarty-develop...@googlegroups.com.

Uwe.Tews

unread,
Nov 21, 2009, 7:30:23 AM11/21/09
to Smarty Developers

The buildin tags for excluding a whole section from caching are
{nocache}.... {/nocache}.

To display a single variable as nocache use {$foo nocache}.

You can define also a variable as nocache when it gets assigned:
$smarty->assign('foo','bar',true);
The third parameter das controll caching. However this setting works
only if the variable is defined as such at compile time of the
template.
> > smarty-develop...@googlegroups.com<smarty-developers%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages