Yii Framework Forum: webapplicationend behaviour - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

webapplicationend behaviour Rate Topic: -----

#1 User is offline   mithereal 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 67
  • Joined: 14-April 10
  • Location:The Radioactive Desert, AZ

Posted 15 April 2010 - 10:16 PM

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
0

#2 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users