Re: [SMARTY] Accessing variables inside {php} sections
| From: | messju mohr | Date: | Mon, 12 Jan 2004 22:15:36 +0000 |
| Subject: | Re: [SMARTY] Accessing variables inside {php} sections | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10815@lists.php.net to get a copy of this message | ||
On Mon, Jan 12, 2004 at 11:06:58PM +0100, Francesco Cipriani wrote:
> Hi all,
> in my php code, I do an assignement like
> $tpl->assign('program', $myprogram);
> Now, I want to access $program from a smarty template, and it's easy if
> I use smarty tags like {$program}, but I want to access it from a {php}
> template section too.
> Smarty, or, better, php, complains that $program is not defined .. so
> 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);
> Bye.
> --
> Francesco