Tag Archive for 'yii'
To get current controller name/id inside your controller, or view
1 2 3 | $controllerId = Yii::app()->controller->id; //or $controllerId = $this->getId(); |
To get current action name/id being executed, if you are inside beforeAction() or afterAction(), use the received CAction argument
1 2 3 4 5 | //inside beforeAction or afterAction public function beforeAction($action) { $actionId = $action->id; ... |
or just elsewhere inside your controller
1 | $actionId = $this->getAction()->getId(); |
1 2 3 4 5 6 | <?php 'class'=>'CDbConnection', 'connectionString'=>'mysql:host=localhost;dbname=yiiblog;unix_socket=/opt/lampp/var/mysql/mysql.sock', 'username'=>'root', 'password'=>'password', 'charset'=>'utf8', |
Recent Comments