Yii Front Controller Implementation before Routing -
i want implement language setter controllers , need run method before routing controller -> front controller.
if have implemented method in controller class, usages must run earlier before controller initilisation
class controller extends ccontroller { public function __construct($id, $module = null) { // set application language if (isset($_get['language'])) { $lang = $_get['language'];
you use onbeginrequest
event of application. requires add code index.php
. here's quick example:
$app = yii::createwebapplication($config); $app->onbeginrequest = function($event) { // ... whatever want } $app->run();
of course instead of closure function can attach other valid callback.
Comments
Post a Comment