Fixing extensions without modifying their code

Comparing #3 with #4

Tags

paths, extensions, alias, aliases, extending, behavior, themes, layouts

Content

[...]
Since the methods from WebUser are now available for RWebUser you can use the same class in both modules.

**Note: This way is not possible for all cases, you can not override existing methods with a behavior, eg. `yii-rights` overrides checkAccess() and other methods of CWebUser.**


 
Theme switching for backend module views
 
----------------------------------------
 
 
Most modules don't allow you to set a theme for it's views, but usually you can define a custom layout file for the module.
 
 
As you can define a custom layout for the module you can do this (eg. file `views/layouts/mytheme.php`):
 
 
    Yii::app()->theme = 'mytheme';
 
    include(dirname(__FILE__).'/main.php');
 
 
Which will set another theme and then just use the main layout file.
 
In your config you should set `//layouts/mytheme` as the default layout for your module.
 
 
You can also do this one a per file/view bases, see [this file](https://github.com/schmunk42/p3bootstrap/blob/9f0df57e2f97639ada612ce724db6408149b4f13/views/rights/default/index.php) for a sample implementation.
 
 
 
 
------------ *These techniques are used in [Phundament](http://phundament.com) to ensure compatibility and minimize additional maintainance and complexity.* -- https://github.com/phundament/app/wiki/Extensions