Hi there, as a beginner in Yii i have a question that I want to create models in iteration. For example I want to create result model for 30 students. How to create these models in iteration? I cant hardcode becaue number students may vary from class to class.
In this approach i need to use tabular input but for that purpose i need to bind each model`s attribute to some element like
textArea
Definitive guide presents this code
<div class="form">
<?php echo CHtml::beginForm(); ?>
<table>
<tr><th>Name</th><th>Price</th><th>Count</th><th>Description</th></tr>
<?php foreach($items as $i=>$item): ?>
<tr>
<td><?php echo CHtml::activeTextField($item,"[$i]name"); ?></td>
<td><?php echo CHtml::activeTextField($item,"[$i]price"); ?></td>
<td><?php echo CHtml::activeTextField($item,"[$i]count"); ?></td>
<td><?php echo CHtml::activeTextArea($item,"[$i]description"); ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php echo CHtml::submitButton('Save'); ?>
<?php echo CHtml::endForm(); ?>
</div><!-- form -->
But how can i populate my array with distinct model names like model1,model2,model3 and so on, in iteration?
thanks