I have a checkboxlist as below:
<?php echo CHtml::activeCheckBoxList($product, 'categories', $categories, array(
'template'=>'<div class="item">{input}{label}</div>',
'separator'=>false,
)); ?>
In the above, the <div class="item"> needs to have a dynamic class applied to it - basically I want to get the ID of the item that is being output and use this value to perform a lookup on another model, e.g
echo Category::model()->getParent($item_id)->name;
So in my example it should output something like
<div class="item cars">
<input type="checkbox" name="Product[Categories][]" value="10" id="Product_categories_0" />
<label for="Product_categories_0">Ford</label>
</div>
I know I can just create my own foreach loop to construct a checkbox output - but then I would lose the useful features that checkboxlist provides.