Im trying to understand more avout how webapplicationend works
specifically with this code
" // of Yii::app()->endName.
$this->foo = (Yii::app()->endName == 'front') 'bar1' : 'bar2';
// Raise onModuleCreate event.
Yii::app()->onModuleCreate(new CEvent($this)); "
can someone please provide more detail on these functioms
Page 1 of 1
webapplicationend behaviour
#2
Posted 15 April 2010 - 11:44 PM
$this->foo = (Yii::app()->endName == 'front') 'bar1' : 'bar2';
should be
$this->foo = (Yii::app()->endName == 'front') ? 'bar1' : 'bar2';
It's a ternary operator. You can configure your module's properties depending on the value of Yii::app()->endName property, which is set in the behavior.
Yii::app()->onModuleCreate(new CEvent($this));
Did you already read about events in Yii?
This syntax raises an event "onModuleCreate" (owner is current module, $this), executing all attached handlers. There is the only attached handler "changeModulePaths". It's logic is simple: take variable $this and change it's controllerPath and viewPath properties.
Share this topic:
Page 1 of 1

Help












