Some times we need to know the current controller/module/action name in our application, Yii provides the default methods to accomplish the tasks.
To get a controller name
To get method/action name
To get module name
To get a controller name
Yii::app()->controller->id //or Yii::app()->getController()->getId()
$this->id here $this refers to current controller
To get method/action name
Yii::app()->controller->action->idYou can get action name in controller
$this->action->id
To get module name
Yii::app()->controller->module->id
$this->module->id