Overriding Module/extension Views

I have very specific ways in which I need to have my views formatted. That means that in the case of certain modules and extensions, such as (but certainly not limited to Yii-User and Yii-Rights), I need to override the module/extension’s views with my own. I know that I can just directly modify the view files in the module or theme, but that seems to be the perfect path to disaster.

I’ve hunted all over yiiframework.com and the Web and found countless suggestions for how to do this — none of which seem to work. Some of the ones that don’t work include:



Also, most of these suggestions seem to involve theming when I’m not trying to impose a new theme on the module/extension. All I want to do is alter the presentation by using Foundation4, fieldsets, etc. In many cases, such as Yii-User, the module specifically allows you to specify a theme, and in others, it’s simple enough to divert the module/extension to a different theme. That, however, does nothing to add fieldsets, grid-based separation of labels from fields, etc.

There surely has to be a uniform, tested method to override a module/extension’s views without modifying the original code. (I would say that Yii can’t be that immature!) How on earth do you do that?

It works actually quite quite well. For me I can overwrite

modules/core/views/user/form.php by creating themes/default/views/core/user/form.php

I have just tested this and it works as expected.

Here are the official details:


While your example is somewhat confusing because it addresses a default them with core views, it did make me look further. I had expected that I would have to include that the views I was overriding were extensions or modules (as would be suggested by your including of “core” in your path), and that definitely does not work. But your comment did make me go back and try something else. The following, as I said, doesn’t work:


but the following does work:


That’s always the problem with Yii. A framework is supposed to save time and make things much more straightforward. Insead, Yii takes a rather roundabout approach to such things, doesn’t provide documentation for simple, common, everyday tasks, and makes you spend hours (and days) trying to figure out how it wants to do things.