i have a layout used by all my views and i need to assign a variable from a controller to this layout , if i use this method on a controller it doesn\'t work :
p
Rob Allen has posted a great article about how to access view variables in another view model (e.g.: layout)
Basically the following code, placed inside your layout.phtml, will match your needs:
viewModel()->getCurrent()->getChildren(); $child = $children[0]; ?> escape($child->myvar);?>