Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_View_Helper_Json Component Proposal

Proposed Component Name Zend_View_Helper_Json
Developer Notes
Proposers Matthew Weier O'Phinney
Revision 0.9.0 - 03 January 2008: Initial proposal release
0.9.1 - 04 January 2008: Initial code released on laboratory
0.9.2 - 08 January 2008: Updated with feedback from Zend team; no longer exits; adds action helper version; disables layouts (wiki revision: 8)

Table of Contents

1. Overview

Zend_View_Helper_Json is a view helper for serializing data to JSON and sending an immediate JSON response to the client.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will serialize received data to JSON.
  • This component will set appropriate HTTP response headers for returning JSON data.
  • This component will provide both an action helper and a view helper, preferably using common backend functionality.
  • This component will disable layouts, if enabled.
  • This component will not exit immediately; that will be left to the developer to implement.

4. Dependencies on Other Framework Components

  • Zend_Json
  • Zend_Controller_Response_Abstract (via Zend_Controller_Front)
  • Zend_Controller_Action_Helper_Abstract

5. Theory of Operation

The helper is called as a normal view helper, serializes the data passed to it, sets the appropriate response header, disables layouts, and returns the serialized JSON.

Called as an action helper, it does all of the above, as well as sets the reponse body to the serialized JSON data.

6. Milestones / Tasks

  • Milestone 1: [ZFPROP:DONE] Create proposal for review
  • Milestone 2: [ZFPROP:DONE] Create working tests and code in laboratory
  • Milestone 3: Move working tests and code to incubator
  • Milestone 4: Create documentation in incubator
  • Milestone 5: Publish to core

7. Class Index

  • Zend_View_Helper_Json
  • Zend_Controller_Action_Helper_Json

8. Use Cases


In a view script:


In an action controller:

9. Class Skeletons





Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jan 09, 2008

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Comments</ac:parameter><ac:rich-text-body>
    <p>This proposal is approved for incubator development, and the following issues are to be addressed:</p>
    <li>Helper should not exit or send response</li>
    <li>Helper should disable layouts</li>
    <li>Add a JSON action helper as part of the proposal</li>