lundi 13 octobre 2014

smarty foreach how does it work correctly?


Vote count:

0




I have a problem with my smarty foreach. It does not output the right thing :S I tried many things but it never worked.



$data = array(
array('name' => "name", 'value' => "test"),
array('name' => "name", 'value' => "test"),
array('name' => "name", 'value' => "test"),
array('name' => "name", 'value' => "test"),
array('name' => "name", 'value' => "test")
);

$smarty->assign('invTalents', $data);

return array(
array(
'type' => 'html',
'html' => $smarty->fetch('*****/*****/smarty.tpl'),

),
);


in smarty.tpl I got this:



<table class="designedTable" style="width:96%; font-size:11px;">
<thead>
<tr>
<td class="clear_first brdRight">
</td><td class="white_last">
</td></tr>
</thead>
<tbody>


{foreach from=$invTalents item=data}
<tr>
<td class="clear_first brdRight">{$invTalents->data}</td><td class="white_last"><strong>0</strong></td>
</tr>
{/foreach}

</tbody>
<tfoot>
<tr><td class="clear_first brdRight"></td><td class="white_last"></td></tr>
</tfoot>
</table>


What am I doing wrong? :)



asked 1 min ago







smarty foreach how does it work correctly?

Aucun commentaire:

Enregistrer un commentaire