Dynamic themes

Hi! Waht should i do to make it dynamic my themes I have several themes here!

The situation is this the themes are store in themes directory right! now the names of it are store in database, I like to call it and put in config but how?

return array(


'name'=>'My Web Application',

    'theme'=>'mytheme is here!',

could you try this

Yii::app()->theme = ‘theme1’;

source : http://www.yiiframework.com/wiki/250#hh16

or you can extend the render to switch themes

public function render($view, $data=null, $return=false) {

// prior to rendering we need to check if we need to

// switch theme

switch ($view) {

case ‘admin’:



case ‘index’:







Where to put the “Yii::app()->theme=‘mytheme’” co’z I place it in config/main and it works, but how to call it from databases?

The plan is the radio button should contain a theme name and update it to the database and retrieve or use it with this function Yii::app()->theme=‘mytheme’ but how to declare and where to place?

There’re different variants depends on your exact application.

You may create component, for example. Or you may start with /components/Controller.php, put call to themes-table and set current theme in init() method. I order to handle themes you may, for example, create /controllers/ThemeController.php and put related functionality there.

Again, definite solution depends on your application design.

Thanks a lot for the information!