I truly apologize if this is a silly question but, I do this all the time with my own code and I would like to do it Yii style. My application works perfect or I thought so until I double checked the cookies on my browser.
The cookie where I store the user language selection keeps being re-created again and again, like if Yii isn’t capable of reading it. I have checked its path and is correct but…
Here is the code, could you please tell me what I am doing wrong?
Could it be that $this->language is empty by default when you create the new cookie? Then the condition in your if statement would fail…
Other than that: Using FF HTTPHeaders extension would show you the “raw” cookie data in the HTTP headers. I often look at them to see what’s really going on under the hood. Maybe it helps tracking down the issue?
The $this->language was ok but in one scenario. I found my issue when I included a silly conditional statement in the code before the function call in my previous post.
Then is when I realized that one of the languages wasn’t properly set on the URL: my default language ($this->languages[] = Language::model()->primaryLang(), which is set in another function This is why it was confusing at first, I was looking at the wrong place.
Thanks Mike as you point me to the right direction on this issue. I should stop programming when is up to 2AM.