Chaning the site themes dynamically

Hi dears,

In my current project, I want to let the use to change the themes as per their preference and I have designed the structure of the application as

Frontend and backend with themes.

Is there any way to change the site theme dynamically?

When a user changes the theme you can set a cookie/session/db-record to remember the theme.

In your base controller you override beforeAction($action) where you set the layout to the user preference with: $this->layout = ‘//layout/’.$userSelectedTheme;

I don’t know if this is the proper way, but I use it and it works fine :)

I have one solution for it which is changing the Application configurations as

Yii::app()->theme='My Theme';

But I want something even batter then that one.

Thanks for sharing your solution.