I’m not entirely clear where to actually put a call to setGlobalState in the code so that every page view, controller, etc… has access to it with yii::app()->getGlobalState?
Any help???
I’m not entirely clear where to actually put a call to setGlobalState in the code so that every page view, controller, etc… has access to it with yii::app()->getGlobalState?
Any help???
Put it in index.php.
require_once($yii);
$app = Yii::createWebApplication($config);
Yii::app()->whatEver();
$app->run();
Duuuuuh. haha
Thanks!
I prefer not to touch index.php much unless i can’t avoid it. All logic related code should reside in my class files. So in this case i would rather override init() in your base controller in components/Controllers.php.
That means that it will only run if a controller is run, which is fine in most situations.