Access module controller variables from view

We all know that we can access controller variables from view using $this->myvariable.

I’d like to know if it is possible to access module controller variables from view. I tried the following but it’s not working:

Yii::app()->controller->module->myvariable

Yii::app()->module will return current module, so if U are asking for myvariable it should be in module class not it’s controller, but Yii::app()->controller will return current controller, I’m not sure what an how are U trying to do but this shuld return your variable if view belongs to this controller

1 Like