Re: [SMARTY] Using smarty variables inside {php} {/php} blocks

From: Date: Wed, 04 Sep 2002 20:48:29 +0000
Subject: Re: [SMARTY] Using smarty variables inside {php} {/php} blocks
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5927@lists.php.net to get a copy of this message
The Smarty variables aren't extracted into the scope of your PHP block. To access them use something like: $this->_tpl_vars["bar"]; It's $this instead of $smarty because the template is called from within the Smarty object. Ben On Wednesday, Sep 4, 2002, at 21:31 Europe/London, Jaime Ashander wrote:
So, I think I may have had this working at one point, but now whenever I try it things go wrong. Example: Foo.php: ------------------ <?php #my smarty is an innocent subclass that simply sets directories require_once 'my_smarty.inc'; $smarty= new My_Smarty(); $smarty->assign('bar', 'I want to be displayed'); $smarty->display('foo.tpl'); ?> Foo.tpl: ------------------ <html> <body> <!-- random code--> Displayed via smarty: {$bar} <br> Displayed via php: {php} $bar {$bar} {/php} </body> </html> -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
(q) Ben Godfrey? (a) Developer and Designer, See http://aftnn.org/ for details

« previous php.smarty.general (#5927) next »