## Apache Zeta Components Manual :: Docs For Class ezcMvcJsonViewHandler

### MvcTools::ezcMvcJsonViewHandler

### Class ezcMvcJsonViewHandler

The view handler that renders result objects as JSON.

Source for this file: /MvcTools/src/view_handlers/json.php

### Implements interfaces:

- ezcMvcViewHandler

Version: | //autogentag//

### Member Variables

protected mixed | `$result` Contains the result after process() has been called.
protected array(mixed) | `$variables = array()` Contains the variables that will be available in the template.
protected string | `$zoneName` Contains the zone name

### Method Summary

public ezcMvcJsonViewHandler | `__construct( $zoneName , [ $templateLocation = null] )` Creates a new view handler, where $zoneName is the name of the block and $templateLocation the location of a view template.
public string | `getName( )` Returns the name of the template, as set in the constructor.
public mixed | `getResult( )` Returns the result of the process() method.
public void | `process( $last )` Processes the template with the variables added by the send() method.
public void | `send( $name , $value )` Adds a variable to the template, which can then be used for rendering the view.

### Methods

#### __construct

ezcMvcJsonViewHandler __construct( string $zoneName , [string $templateLocation = null] )

Creates a new view handler, where $zoneName is the name of the block and $templateLocation the location of a view template.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$zoneName` | string |
`$templateLocation` | string |

##### Implementation of:

Method | Description
--- | ---
`ezcMvcViewHandler::__construct()` | Creates a new view handler, where $name is the name of the block and $templateLocation the location of a view template.

#### getName

string getName( )

Returns the name of the template, as set in the constructor.

##### Implementation of:

Method | Description
--- | ---
`ezcMvcViewHandler::getName()` | Returns the name of the template, as set in the constructor.

#### getResult

mixed getResult( )

Returns the result of the process() method.

##### Implementation of:

Method | Description
--- | ---
`ezcMvcViewHandler::getResult()` | Returns the result of the process() method.

#### process

void process( bool $last )

Processes the template with the variables added by the send() method.

The result of this action should be retrievable through the getResult() method.

The $last parameter is set if the view handler is the last one in the list of zones for a specific view. Only in that case is json_encode() used to generate JSON output.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$last` | bool |

##### Implementation of:

Method | Description
--- | ---
`ezcMvcViewHandler::process()` | Processes the template with the variables added by the send() method.

#### send

void send( string $name , mixed $value )

Adds a variable to the template, which can then be used for rendering the view.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$name` | string |
`$value` | mixed |

##### Implementation of:

Method | Description
--- | ---
`ezcMvcViewHandler::send()` | Adds a variable to the template, which can then be used for rendering the view.

Documentation generated by phpDocumentor 1.4.3