Difference between #5 and #6 of
Behaviors & events

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()->on
bBeginRequest = create_function('$event', 'return ob_start("ob_gzhandler");'), Yii::app()->oneEndRequest = 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:
[...]
43 0
48 followers
Viewed: 134 770 times
Version: 1.1
Category: Tutorials
Tags:
Written by: pestaa
Last updated by: Gismo
Created on: Aug 24, 2009
Last updated: 5 years ago
Update Article

Revisions

View all history