Nique, on 15 January 2010 - 07:12 AM, said:
I think i need to do something with that onbeginrequest thing, but i dont understand that function as there are no 'guides' on this.
Yii uses the Observer pattern to provide an event-driven system similar to the PRADO framework.
The online definitive guide docs and the PDF version have different content. Event components are described in the PDF file. From what I can understand, it appears that a component needs to be created extended from CEvent and that component must be preloaded in the main.php config file. I find this a bit odd since modules should contain all files required to use the module. I would imagine that the Event component could be stored in the module's components/ directory and preloaded from that directory in main.php.
The onbeginRequest($event) method is at line 166 of CApplication. CApplication processes incoming requests. The $event parameter is a CEvent object type, and CEvent is extended from CComponent. If you read about application life cycles in the definitive guide, onbeginRequest and onEndRequest are breifly mentioned there and this will give you a basic idea of the general application flow as a request is processed.
The onBeginRequest and onEndRequest methods are basically hook points in the application life cycle. A hook point in the life cycle allows additional actions to be performed as part of the normal application life cycle.