Re: [SMARTY] {php} and template: variables back and forth
| From: | Monte Ohrt | Date: | Fri, 17 Jan 2003 20:37:25 +0000 |
| Subject: | Re: [SMARTY] {php} and template: variables back and forth | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7260@lists.php.net to get a copy of this message | ||
... and actually if you are just assigning vars, use the template
function, not php tags. Avoid php tags whenever possible.
{assign var="foo" value="bar"}
On Fri, 2003-01-17 at 02:54, philippe.morange@ca-indosuez.com wrote:
> Hi,
> The title says most of what I need to do.
>
> Inside a template, I have to use {php} ... {/php} tags.
> But I noticed that variables from the template that are above {php} are not accessible within
> the
> tags, and variables I set and assign between {php} tags are not accessible after that in the
> template.
>
> I'd like to be able to assign some variables in {php}...{/php}, right inside a template,
> and use
> those new variables afterwards in the template...
>
> Kind of like so:
> - - - - - - - toto.tpl - - - - - - -
> ...smarty stuff...
>
> {php}
> ...php stuff...
> $smarty->assign('toto', $toto);
> {/php}
>
> ...more smarty stuff...
> The var is {$toto}
> - - - - - - - - - - - - - - - - - - - -
>
> Thanks for your help,
> Philippe.
--
Monte Ohrt <monte@ispi.net>