Hello Community!
I want to load three extra models into my admin.php, so that I can access them in the view.
My Controller:
public function actionAdmin()
{
$model = new Frage('search');
$model2 = new Klient('search');
$model3 = new Person('search');
$model4 = new Erhebung('search');;
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Frage']))
$model->attributes=$_GET['Frage'];
$model2->unsetAttributes();
if(isset($_GET['Frage']))
$model2->attributes=$_GET['Klient'];
$model3->unsetAttributes();
if(isset($_GET['Frage']))
$model3->attributes=$_GET['Person'];
$model4->unsetAttributes();
if(isset($_GET['Frage']))
$model4->attributes=$_GET['Erhebung'];
$this->render('admin',array(
'model'=>$model,$model2,$model3,$model4
));
My View:
(here I want to access $model2)
<div class="row">
<?php echo $form->labelEx($model2,'kid'); ?>
<?php echo $form->dropDownList($model,'kid',
CHtml::listData(Klient::model()->findAll(),'kid','bez')); ?>
<?php echo $form->error($model,'kid'); ?>
</div>
ERROR: Undefined variable: model2
When I use $model instead of $model, ERROR is: Property “Frage.kid” is not defined. (that’s logical)
How can I access the other models in my admin view?
Best regards