To get current controller name/id inside your controller, or view
[cc lang='php']$controllerId = Yii::app()->controller->id;
//or
$controllerId = $this->getId();[/cc]
To get current action name/id being executed, if you are inside [cci]beforeAction()[/cci] or [cci]afterAction()[/cci], use the received CAction argument
[cc lang='php']
//inside beforeAction or afterAction
public function beforeAction($action)
{
$actionId = $action->id;
...
[/cc]
or just elsewhere inside your controller
[cc lang='php']$actionId = $this->getAction()->getId();[/cc]
Great post. I was checking constantly this weblog and
ReplyDeleteI am impressed! Very useful info specifically the last phase :) I
take care of such information much. I used to
be looking for this certain info for a long time. Thanks and good luck.