After you install this extension, you will be able to create "installable" extensions, from where you can hook into the Yii controllers.
Because this extension will hook into Yii's defined application events, you can pretty much do everything(yes, you can even create controllers from your extensions/etc).
Tested on Yii 1.1.10 and php 5.2.6
1) Extract the archive and copy the contents of the protected folder over your application protected folder.
2) Change config/main.php like:
// preload the component 'preload'=>array('log', 'extensionLoader'), // define it 'components'=>array( 'extensionLoader'=>array( 'class' => 'ExtensionLoader', ), ),
Defined events ¶
This extension defines the following events:
- onBeforeInit (called in CController::init() )
- onAfterInit (called in CController::init() )
- onBeforeAction (called in CController::beforeAction() )
- onAfterAction (called in CController::afterAction() )
- onBeforeRender (called in CController::beforeRender() )
- onAfterRender (called in CController::afterRender() )
- onBeforeProcessOutput (called in CController::beforeProcessOutput () )
- onAfterProcessOutput (called in CController::afterProcessOutput () )
There is also a ControllerBehavior which implements these events and their event handlers, so you can create new behaviors extending ControllerBehavior and hook into existing events.
In the archive, you will find an "example-extension" which implements some of the features this extension can provide.
Please study that extension several times before asking questions that could be answered by reading the source code.
For better understanding, i recommend installing the extension on a clean application, then move it to your real application.
This extension is created for my needs, but i adjusted it a bit so that i can share it with everybody. Also, i haven't had too much time to improve things (there is room for better as always) but this is a working version and any feedback is appreciated.