I want to send a parameter from controller to layout (i.e. main.php). But I am not able to get the param in main.php
I tried:
Controller Code:
In Yii2 you can access your controller object from a view using $this->context for example if in your controller you set a parameter like this:
public $title = 'My custom title';
Then in your layout you can read it like this:
$this->context->title
It is explained in Yii documentation in section: Accessing Data in Views