Re: [SMARTY] Accessing variables inside {php} sections
| From: | Francesco Cipriani | Date: | Mon, 12 Jan 2004 23:41:06 +0000 |
| Subject: | Re: [SMARTY] Accessing variables inside {php} sections | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10816@lists.php.net to get a copy of this message | ||
On Mon, Jan 12, 2004 at 11:15:36PM +0100, messju mohr wrote:
> > what is the solution? How can I access assigned variables from php
> > sections in smarty's templates?
>
> the included php runs in the context of a method of your smarty
> instance: you can use: $program = $this->get_template_vars('program);
Thank you.
Maybe it would be nice to have this included in the manual, {php} section.
It seems to me that the variables' scope inside templates isn't well
specified.
Suppose I want to use in a smarty tag a variable just declared in a php
sectin, what it the right way to do this?
I mean, something like
{php}
$var = 'hello';
{/php}
{$var (or_what_else??)}
--
Francesco