News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
Access view variables in another view model
April 03, 2012 @ 12:53:37

In this new post to his blog Rob Allen shows you how to access the view variables from another ViewModel.

Unlike Zend Framework 1, the view layer in Zend Framework 2 separates the variables assigned to each view model. This means that when you are in the layout view script, you don't automatically have access to variables that were assigned the the action's view model and vice versa.

He includes snippets of code with an example controller and a sample view that fetches a value from a child ViewModel instance. He also shows how to access layout and configuration values in the view.

0 comments voice your opinion now!
view model variables other scope child viewmodel zendframework2


blog comments powered by Disqus

Similar Posts

DevShed: Building a Web Page Controller for Simulating the Model-View-Controller Schema in PHP

Refulz.com: CakePHP evolves to 2.0

CodeSnipers.com: Stupidly Easy MVC - Group Membership Application (Part 2)

Jacob Santos' Blog: Patterns for PHP: Page Controller Draft

Felix Geisendorfer's Blog: Validating the cleaned output of HtmlHelper::dateTimeOptionTag()


Community Events





Don't see your event here?
Let us know!


tool community series podcast version release laravel voicesoftheelephpant security library composer language introduction update symfony package mvc framework interview opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework