Revision #6 has been created by yasen on Jan 3, 2013, 7:22:35 AM with the memo:
onbeginRequest => onBeginRequest
« previous (#5) next (#7) »
Changes
Title
unchanged
Behaviors & events
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Content
changed
[...]
For example, [enabling gzip](http://www.yiiframework.com/doc/cookbook/39/) compression on the output could be done via extending CWebApplication. But because there are entry points for event handlers, one can do this:
```php
Yii::app()->onbBeginRequest = create_function('$event', 'return ob_start("ob_gzhandler");'),
Yii::app()->on
eEndRequest = create_function('$event', 'return ob_end_flush();'),
```
You can create an event handler -- which is simply a method in some class with a specific signature -- and attach it to the event of an object. You can add as many event handlers as you wish, from as many objects as you wish. If the event handler is, effectively static, then you can create the object as you assign it:[...]