Working with View
View can be considered very important as it actually renders the content that is being outputted to the browser of the user. Therefore, we can assume that knowing how View works is very useful when creating web applications.
Getting ready
For this recipe it is beneficial if we have the Zend Framework 2 skeleton set up and ready to work. We will do some basic things to get you started, so no additional extensions are necessary for this.
How to do it…
We are going to output content to the browser by using PhpRenderer
which is the default view strategy used.
Configure the ViewManager
We make the following alterations to the /module/Application/config/module.config.php
file:
<?php return array( 'view_manager' =>array( // We want to show the user if the page is not found 'display_not_found_reason' => true, // We want to display exceptions when the occur 'display_exceptions' => true, // This defines the doctype we want to use in our // output...