Controller Action
public function actionCreate()
{
$model=new News;
$contentModel = new NewsContent;
// if I do a `var_dump( $contentModel )` here, I get variable dump correctly
$this->render('create',array(
'model'=>$model,
'contentModel'=>$contentModel,
));
}
View
<?php var_dump( $model ); // dumps the variable correctly ?>
<?php var_dump( $contentModel ); // dumps null ?>
So why is contentModel not being passed to the view and model is?
Note that I have verified that I am referencing the correct view. I have tested this by not passing the model variable and seeing a null dumped in place of original variable dump in the view
Both
actionCreateandactionUpdaterender thecreateandupdateviews respectively, but both views also partially render the_formview, where basically everything is displayed.Also, take a look at this, it helped me a lot when I was getting to know Yii. Understanding the view rendering flow