Hi, I want to send data from view to layoout, how can I do this ?
that makes no sence ?
but your view data is available in your layouts as well as in your views
Instead of MVC architecture, you might want to revert back to Spaghetti one.
Views represent the user interface of your application. Views are often HTML files with embedded PHP code that perform tasks related solely to the presentation of the data. Views handle the job of providing data to the web browser or other tool that is used to make requests from your application.
I've maked a breadcrumbs widget and I needed to send breadcrumbs data to layout.
I call one time the widget in layout, and every where I need to render this widget just set $breadcrumbs variable in my view.
$title = 'User List';
$breadcrumbs = ['label' => 'Users', 'url' => $this->url->get('user/index')];
$breadcrumbs = $title;
<?= \Multiple\Widget\Breadcrumb::widget([ 'items' => $breadcrumbs ?? , ]) ?>