Can anyone please tell me, how can I access the variables, which are defined in the init function of a controller, inside the actions of the controller. I don’t want to use Yii::app()->params for this. Also, using $var or $this->var doesn’t works.
Thnx
First of all you need to understand the PHP variable scope - check the PHP variable scope documentation
So…
If a variable is defined in a method / function it is visible only for that function…
If a variable is defined in a class than you can access it as $this->variable inside the methods of that class…