Using the model inside a layout

I’m trying to use variables inside my model for one of my layouts. How do I access the model from inside a layout view?

You could use params property of View:




\Yii::$app->view->params['customParam'] = 'customValue';



http://www.yiiframework.com/doc-2.0/guide-structure-views.html#sharing-data-among-views

http://www.yiiframework.com/doc-2.0/guide-structure-views.html#rendering-views

You simply pass the model in the call to ‘render’.