Pages

Thursday, August 4, 2011

Assign an smarty variable to a PHP variable

Developer can use PHP code in smarty(.tpl file code) within a {php} block or an {include_php}.

when developer use a {php} block inside a Smarty template developer are inside the Smarty scope (object)
So when
developer need to reference a Smarty method developer would use $this
so when developer assign an smarty variable to a php variable it looks something like this in smarty:

Code:
{php}
   $t = $this->get_template_vars( 'foo' );
{/php}

No comments:

Post a Comment