pass variable to Yii app from outsite

Hello everybody,

I am in an urgent need to solve one problem.

In /protected directory I created file action.php. In that file I have calculated a variable and I need this variable to put in my Yii application.

How is it possible to make this variable accessible to Yii::app()?

For example I need to use this variable in /protected/components/ApplicationBehavior.php file.


You can create a class in component with a static method:

class myVar


   public static function var()


       [your code here]

       return $variable;



Now, whereever in your code, you can do


and obtain the value you need.

Thank you, do I need to put anything in config?

No, usually in config there is something like





That means that everithing that stays in components (and models) is authomatically included