I use the smarty tpl.
Now i have a php code and i want to use it in tpl:
Tis is the output from the array.
stdClass Object
(
[Status] => success
[Time] => 2011-01-01 12:00:00
[IP] => 12.34.56.789
[Count] => 1
[Filter] => stdClass Object
(
[Sort] => ProductCode
[Order] => DESC
[Search] =>
[ProductCode] => P001
[ProductType] =>
)
[Result] => stdClass Object
(
[Products] => Array
(
[0] => stdClass Object
(
[Identifier] => 1
[ProductCode] => test
[ProductName] => test
)
)
)
Tis is the php code that works:
foreach ($product_list->Result->Products as $product) {
echo $product->ProductName;
}
I use the follow tpl code but this doesn’t work
//in php
$smarty->assign("data", $product_list);
//in tpl file
{foreach item=item from=$data}
<tr>
<td align="center">{$item.Result->Products->ProductName}</td>
<td align="center"></td>
<td align="center"></td>
<td align="center"><a href="" class="usuallink">{$header.order}</a></td>
</tr>
{/foreach}
Does anyone now how i can fix this?
Working code from php will look like this:
in smarty3 it can look even more like pure php: