Zend Framework  1.12
Public Member Functions | Public Attributes | List of all members
Zend_Controller_Action_Helper_Json Class Reference

Public Member Functions

 encodeJson ($data, $keepLayouts=false, $encodeData=true)
 Create JSON response.
 
 sendJson ($data, $keepLayouts=false, $encodeData=true)
 Encode JSON response and immediately send.
 
 direct ($data, $sendNow=true, $keepLayouts=false, $encodeData=true)
 Strategy pattern: call helper as helper broker method.
 
- Public Member Functions inherited from Zend_Controller_Action_Helper_Abstract
 setActionController (Zend_Controller_Action $actionController=null)
 setActionController()
 
 getActionController ()
 Retrieve current action controller.
 
 getFrontController ()
 Retrieve front controller instance.
 
 init ()
 Hook into action controller initialization.
 
 preDispatch ()
 Hook into action controller preDispatch() workflow.
 
 postDispatch ()
 Hook into action controller postDispatch() workflow.
 
 getRequest ()
 getRequest() -
 
 getResponse ()
 getResponse() -
 
 getName ()
 getName()
 

Public Attributes

 $suppressExit = false
 

Additional Inherited Members

- Protected Attributes inherited from Zend_Controller_Action_Helper_Abstract
 $_actionController = null
 $_actionController
 
 $_frontController = null
 

Member Function Documentation

direct (   $data,
  $sendNow = true,
  $keepLayouts = false,
  $encodeData = true 
)

Strategy pattern: call helper as helper broker method.

Allows encoding JSON. If $sendNow is true, immediately sends JSON response.

Parameters
mixed$data
boolean$sendNow
boolean$keepLayouts
boolean$encodeDataEncode $data as JSON?
Returns
string|void
encodeJson (   $data,
  $keepLayouts = false,
  $encodeData = true 
)

Create JSON response.

Encodes and returns data to JSON. Content-Type header set to 'application/json', and disables layouts and viewRenderer (if being used).

Parameters
mixed$data
boolean$keepLayouts
boolean | array$keepLayouts
boolean$encodeDataProvided data is already JSON NOTE: if boolean, establish $keepLayouts to true|false if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false if $keepLayouts and parmas for Zend_Json::encode are required then, the array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false that will not be passed to Zend_Json::encode method but will be passed to Zend_View_Helper_Json
Exceptions
Zend_Controller_Action_Helper_Json
Returns
string
See Also
Zend_View_Helper_Json
Zend_Controller_Action_HelperBroker
sendJson (   $data,
  $keepLayouts = false,
  $encodeData = true 
)

Encode JSON response and immediately send.

Parameters
mixed$data
boolean | array$keepLayouts
$encodeDataEncode $data as JSON? NOTE: if boolean, establish $keepLayouts to true|false if array, admit params for Zend_Json::encode as enableJsonExprFinder=>true|false if $keepLayouts and parmas for Zend_Json::encode are required then, the array can contains a 'keepLayout'=>true|false and/or 'encodeData'=>true|false that will not be passed to Zend_Json::encode method but will be passed to Zend_View_Helper_Json
Returns
string|void

Member Data Documentation

$suppressExit = false