E
E
Evgeny_Shestakov2016-03-01 14:14:55
Yii
Evgeny_Shestakov, 2016-03-01 14:14:55

What is the best way to display a widget with parameters from the controller in the layout?

The task is to display the widget in the layout with type parameters: region, etc., these parameters are obtained in the controller action, how best to transfer from the controller to the layout?
ps in Yii 1 (it wasn't exactly MVC), this task was solved by defining a controller property, and since $this in view and layout pointed to the controller, then the parameter to get was of the type: $this->param. What is the right way to approach now?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Arutyunov, 2016-03-01
@arutyunov

How to pass param from controller to layout in YII2
Controller:
Views + Layout:

/* @var $this yii\web\View */
echo $this->params['customParam'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question