Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcMvcView

MvcTools::ezcMvcView

Class ezcMvcView

The abstract view that you need to inherit from to supply your view zones.

Source for this file: /MvcTools/src/view.php

Version:   //autogentag//

Member Variables

protected ezcMvcRequest $request
Holds the request object
protected ezcMvcResult $result
Holds the result object, that's the result of all the views.

Method Summary

public ezcMvcView __construct( $request , $result )
Creates the view object
public ezcMvcResponse createResponse( )
This method is called from the dispatched to create the rendered response from the controller's result.
protected mixed createResponseBody( )
Creates a controller from the set of routes.
public abstract array(ezcMvcViewHandler) createZones( $layout )
The user-implemented that returns the zones.

Methods

__construct

ezcMvcView __construct( ezcMvcRequest $request , ezcMvcResult $result )

Creates the view object

Parameters:
Name Type Description
$request ezcMvcRequest
$result ezcMvcResult

createResponse

ezcMvcResponse createResponse( )

This method is called from the dispatched to create the rendered response from the controller's result.

It calls the createResponseBody() to do the actual rendering. If any exception is thrown in any of the view handlers, this method catches it and returns that exception object to the dispatcher. The dispatcher must therefore check whether an exception object was returned. In case there was an exception, the dispatcher can take appropriate actions such as rendering a fatal error template.

If everything goes well, this method returns an ezcMvcResponse object with the headers from the $result, and the response body from the processed views.

createResponseBody

mixed createResponseBody( )

Creates a controller from the set of routes.

This method is run by the createResponse() method to obtain a rendered result from data from the controller. It uses the user implemented createZones() method from the inherited class to fetch the different zones of the view, and then loops over these zones in order. Each zone's results are made available to subsequent zones. Each zone will be processed by a view handler of the ezcMvcViewHandler class.

Exceptions:
Type Description
ezcBaseValueException when one of the returned zones was not actually an object implementing the ezcMvcViewHandler interface.
ezcMvcNoZonesException when there are no zones defined.

createZones

array(ezcMvcViewHandler) createZones( bool $layout )

The user-implemented that returns the zones.

This method creates all the zones that are needed to render a view. A zone is an array of elements that implement a view handler. The view handlers do not have to be of the same type, as long as they implement the ezcMvcViewHandler interface.

The $layout parameter can be used to determine whether a "page layout" should be added to the list of zones. This can be useful in case you're incorporating many different applications. The $layout parameter will be set to true automatically for the top level createZones() method, which can then chose to add zones from other views as well. The createZones() methods from those other views should have the $layout parameter set to false.

Parameters:
Name Type Description
$layout bool
Documentation generated by phpDocumentor 1.4.3