Cannot use $this in a template
Posted: Mon Nov 18, 2013 6:32 am
Hi I am CmsMs new comer, but experienced in smarty.
I bumped into a strange behavior in a template.
It does not recognizes $this as a smarty pointer and crashes when I try to use it for assign.
I found out that there is a $smarty pointer. It does not crash when I use assign with it, but the variable is not set either.
Please help,
Ronny
I bumped into a strange behavior in a template.
It does not recognizes $this as a smarty pointer and crashes when I try to use it for assign.
Code: Select all
{php}
$solutions = get_solutions_from_db();
$this->assign('solutions', $solutions); // CRASHES
{/php}
{$solutions|@print_r}
Code: Select all
{php}
$solutions = get_solutions_from_db();
global $smarty;
$smarty->assign('solutions', $solutions); // OK
{/php}
{$solutions|@print_r} {* NOTHING *}
Ronny