zend framework2 - access controller action variables to zf2 layout -


i have created 2 layouts: 1 login page , rest of site. after login want pass variables login controller zf2 layout, not able access.

how can access variables in layout created in controller action?

some ways in controller:

using view model

$viewmodel = new viewmodel(); $viewmodel->setvariable('myvar', $myvar); return $viewmodel; 

using layout()

$this->layout()->myvar = $myvar; 

into view script

<?php echo $this->myvar; ?> 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -