Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Front Controller Parameters

In the introduction, we indicated that the front controller also acts as a registry for the various controller components. It does so through a family of "param" methods. These methods allow you to register arbitrary data -- objects and variables -- with the front controller to be retrieved at any time in the dispatch chain. These values are passed on to the router, dispatcher, and action controllers. The methods include:

  • setParam($name, $value) allows you to set a single parameter of $name with value $value.

  • setParams(array $params) allows you to set multiple parameters at once using an associative array.

  • getParam($name) allows you to retrieve a single parameter at a time, using $name as the identifier.

  • getParams() allows you to retrieve the entire list of parameters at once.

  • clearParams() allows you to clear a single parameter (by passing a string identifier), multiple named parameters (by passing an array of string identifiers), or the entire parameter stack (by passing nothing).

There are several pre-defined parameters that may be set that have specific uses in the dispatch chain:

  • useDefaultControllerAlways is used to hint to the dispatcher to use the default controller in the default module for any request that is not dispatchable (i.e., the module, controller, and/or action do not exist). By default, this is off.

    See MVC Exceptions You May Encounter for more detailed information on using this setting.

  • disableOutputBuffering is used to hint to the dispatcher that it should not use output buffering to capture output generated by action controllers. By default, the dispatcher captures any output and appends it to the response object body content.

  • noViewRenderer is used to disable the ViewRenderer. Set this parameter to TRUE to disable it.

  • noErrorHandler is used to disable the Error Handler plugin. Set this parameter to TRUE to disable it.

Zend Framework