Posted by sksksk on 11/12/07 22:06
I want to achieve the following process in the smarty
for $item['menu' . $i] one i should be able to get the value using
loop.index, but
without any luck.
any help is appreciated.
<?php for ($i = 1; $i <= 30; $i++) : ?>
<tr>
<th><?= $i ?></th>
<td><input type="text" class="text1" name="menu<?= $i ?>"
value="<?= $item['menu' . $i] ?>"/></td>
<td><input type="text" class="price" name="menu<?= $i ?>_price"
value="<?= $item['menu' . $i . '_price'] ?>"/></td>
</tr>
<?php endfor; ?>
====SMARTY====
{section name=loop start=1 loop=30}
<tr>
<td>{$smarty.section.loop.index}</td>
{assign var="i" value=$smarty.section.loop.index}
<td><input type="text" class="text1" name="menu{$i}"
value="{$item}{'menu$i}"/></td>
</tr>
{/section}
Navigation:
[Reply to this message]
|