I’m having trouble figuring out how to make some variables I need in views that are in essence global - are used in variety of views and passing then to the views all the time is just tedious.
I can’t use Yii::app()->params because those variables are dynamic and are based on current URL, so they are processed on application startup.
Essentially this is not only for views, but for the whole application itself (but I use those mainly in views). And the most part that makes it all suck - it’s a multi site application. One code base supporting 5 sites and growing. That’s why I need pure dynamic solution, but as clean as possible because the base will be used for other projects too.
Sorry, didn’t see this when it was originally posted.
It sounds like you’re running multiple page calls? The data will be reset between each page load if you’re storing it this way. This is really only useful for passing data between components during the same page call, unless you’re using a $this->forward() call on the controller.
If you want storage that persists between page loads, you should try setting it to the state for the user, using
It wasn’t clear from your original problem if you were looking for something by user (which Dana’s response handles) or something truly global at the application level.