0
我想知道如何使用smarty为每个复选框获取html_checkboxes循环索引的索引?html_checkboxes在smarty模板中的循环索引问题
http://www.smarty.net/manual/en/language.function.html.checkboxes.php
我想知道如何使用smarty为每个复选框获取html_checkboxes循环索引的索引?html_checkboxes在smarty模板中的循环索引问题
http://www.smarty.net/manual/en/language.function.html.checkboxes.php
你将不得不修改函数来做到这一点。正如所写的,它不是为了给你提供这些信息。如果你需要的指数,你可以在一个智者循环实现您的复选框:
<?php
$smarty->assign('checkboxes', array('value1', 'value2','value3','value4'));
?>
和你的Smarty代码:
{ foreach from=$checkboxes item=value name=checkboxloop }
<input type="checkbox" name="whatever_name[{$smarty.foreach.checkboxloop.index}]" value="{$value}" />
{ /foreach }
因此,在这种情况下,指数(从零开始)是获得通过{$smarty.foreach.checkboxloop.index}
如果你想要它从1开始它的{$smarty.foreach.checkboxloop.iteration}
除了有索引什么是目标,获取索引的目的是什么? – mcgrailm 2010-10-08 18:23:18