Archive for Wednesday, 21st April 2010

| 21/04/2010, 13:24 Name of current module controller or action from Yii view

I've been using Yii framework a fair bit recently and it seems very nice so far.  However I couldn't easily find out how to get hold of these often essential pieces of information from a Yii view.  Useful in situations where you want to build a navigation user interface element etc. This is all you need to know...  

// Module
if(isset($this->module)): echo $this->module->getName(); endif;

// Controller
echo $this->ID;

// Action
echo $this->action->id;