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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -