Undefined Variable: Model

ok so in my sitecontroller and in index action, i have the following

$this->render(‘index’,array(‘model’=>$model,‘Usermodel’=>$Usermodel));

my layout file consists of 3 files, navigation.php (navigation logic), main.php ($content), footer.php

in my navigation logic , i.e navigation.php, I have the sign in form

:

:

:

<?php echo CHtml::activeTextField($model,‘Email’,array(‘class’=>‘form-control’,‘id’=>‘Email’,‘placeholder’=>‘yourname@email.com’)) ?>

:

:

:

QUESTION : is the $model variable not passed in the navigation?

the reason you don’t have access to $model in your navigation because you are passing that data to index view not to the layout if you wanna access that in your layout you can use a property on your controller


<?php

SiteController extends Controller 

{

     public $model;


    ...

         $this->model = $model;

         $this->render('index',array('Usermodel'=>$Usermodel));

    ...


}

// in your view/layout/navigation


$this->model