Hi,
I need to pass an array of models view a view for the purpose of updating a page which contains multiple images.
In my controller, I have
$criteria = new CDbCriteria();
$criteria->compare("f_id",$model->id);
$modelPageFile = PageFile::model()->findAll($criteria);
where f_id is the foreign key relating to the ID of the page.
At the moment I’m using
$this->render('update',array(
'model'=>$model,
'modelPageFile' => $modelPageFile,
));
but the view (_form.php) is generating errors; here’s the mark up I’m using to create the file inputs
<div class="row">
<?php echo $form->labelEx($modelPageFile,'[0]Small image'); ?>
<?php echo $form->fileField($modelPageFile,'[0]Small image'); ?>
<?php echo $form->error($modelPageFile,'[0]Small image'); ?>
<?php echo $form->labelEx($modelPageFile,'[0]Large image'); ?>
<?php echo $form->fileField($modelPageFile,'[0]Large image'); ?>
<?php echo $form->error($modelPageFile,'[0]Large image'); ?>
</div>
error message is "get_class() expects parameter 1 to be object, array given".
How do I pass the array of models to my view for this purpose?
Many thanks