I want to use a loop in smarty to read an object value which i will be passing from controller later on.
{foreach from=$foo->bars item=bar}
{$bar->product->name}
{$bar->code}
{/foreach}
To initialize this, i wrote the following code in smarty file:
{php}
$bar1->product->name = "prod1";
$bar1->code = "BC5E";
$bar2->product->name = "prod2";
$bar2->occasionName = "XW9D";
$this->assign($foo->bars, array($bar1,$bar2);
{/php}
But this gives me an error, is this the right way to create an object in Smarty ?