Creating A Default Theme

Hi guys, basically what I want to ask is about making a default theme in Yii. I’ve already read the guide by the way. This theme will probably be the only one I need. Should I be designing it under the “classic” theme folder or the traditional way in the web root? The problem here is that I might still want the default Yii theme for widgets and Gii generate code during development as templates, so I can’t just overwrite the original CSS and images.

How should I go about doing this?

Are there and performance issue when using the theme instead of the web root folder?

Lastly, would you recommended publishing images, CSS and JS files as assets or just use them directly?

You can create a new theme near the default one and use the resources from there or publish them.

Creating a new theme does NOT mean the styles/scripts for Yii Widgets are not available anymore, they still are, but if you noticed, each widget let’s you define your own stylesheet, so you will do exactly that, when creating a widget, use your own style with it, placed in your theme or publish it in assets folder(this is your personal decision but think if your widget will be used by other themes and it will keep it’s look, if so, then the assets folder might be a wiser choice, else, a css/js folder under the theme would do just fine)

Regarding the performance, no, you have nothing to lose if you use themes (there is no real performance degrade when using themes)

I think it would be best for you to create a new theme under the themes folder. For example, name it newTheme, then in your config/main.php, declare your theme like




return array(

   'theme' => 'newTheme',

   ...



Copy the contents of the classic theme to newTheme, then start editing the styles as required by your application.

I honestly did not understand your question when you say instead of the web root folder. Do you mean the default Yii theme? Well, I can’t find any significant performance issues when I use themes for my application (actually, I use different themes per module, still no significant loss in performance). But of course, the overall performance effect of your theme depends on how heavy you use graphics and javascripts and many other stuff in your application.

I’d go for publishing public files.

Alright, thanks a lot.