tags:

views:

16

answers:

1

hello ,,

i want know how to get the index of html_checkboxes loop index with smarty for each checkbox ??

http://www.smarty.net/manual/en/language.function.html.checkboxes.php

A: 

You would have to modify the function to do that. As written it's not designed to give you that information. If you need the index you can implement your check-boxes in a smarty loop:

<?php

$smarty->assign('checkboxes', array( 'value1', 'value2','value3','value4' ) );

?>

And your smarty code:

{ foreach from=$checkboxes item=value name=checkboxloop }
<input type="checkbox" name="whatever_name[{$smarty.foreach.checkboxloop.index}]" value="{$value}" />
{ /foreach }

So in that case the index (starting from zero) is access by {$smarty.foreach.checkboxloop.index} if you want it starting from 1 it's {$smarty.foreach.checkboxloop.iteration}

Cfreak