How to change the module views path?


The DEFAULT views path for modules is:


But i want change to:




I think this will work when you put all of the

mymodule/views folder to themes/views/module/mymodule folder

No, it doesnt works. I already try it.

Here is said:

Therefore try:


And let us know if it solve.

Hi Zaccaria.

It works like a charm.


I noticed that is a quite spread practice to use only the theme folder for save the views.

I’d like to ask, why you all so hate to leave the default theme in the standard location?

When I do a site with differen themes, I always do the default in the default location, when I develop the theme usually I override the layout and a few of views, sometime only the layout.

What I noticed reading many thread, is that lot of people develop all themes independently, without a default one.


Hi zaccaria.

What you wanna say when you say "standard location"?

The themes always in "/themes" location, no? My themes folder is on default location, i only dont understand whats the place to the application get modules views on theme folder, because this i have created another themes folder in /app/themes.

Do you have messenger or skype to we talk more about Yii?

I dont understand what you say about "develop other themes without a default one"! Exists a default theme? We can create a default theme with only the views and another theme with only CSS/JS and layouts?

You can place the views in /views/controllerName/viewname.php, this is what I mean with “standard location”, and the theme that don’t use any view we can call default theme.

Now, if you set a theme, the basic views will be overriden by the view of the theme. If you develop a good standard theme you can override a few view, for example only the layout, for including different css, so you can create new themes with a small effort.

This works only if your standard theme has all the views needed.

If we want to use same layout for all of the themes then there is no need to create views in themes section but if we want to set diffident layouts i.e.

1 column layout for one theme

2 column layout for another theme

then we should create views in themes.

I have found the following code working for module views path