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
Post a Comment