Zend Framework 2 - Layout and variable

前端 未结 6 814
醉梦人生
醉梦人生 2021-01-31 04:50

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         


        
6条回答
  •  情话喂你
    2021-01-31 05:09

    Have you tried:

    $this->layout()->testvar = 'bla';
    

    Using the layout controller plugin you can retrieve the ViewModel object that is used in layout.phtml.

提交回复
热议问题