Revision #79 has been created by rackycz on Sep 20, 2019, 3:22:51 PM with the memo:
edit
« previous (#78) next (#80) »
Changes
Title
unchanged
Yii v2 for beginners
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2
Content
changed
[...]
}
return $this->redirect(['site/index']);
}
```
As you can see when the language is changed, redirection to site/index happens. Also mind that we are not modifying the attribute from config/web.php using Yii::$app->language, but we are saving the value into the session. The reason is that PHP deletes memory after every click, only session is kept.
We then can use the
langID-value in other controllers
and views using
new method beforeAction:
```php
public function beforeAction($action) {
if (!parent::beforeAction($action)) {[...]