909. Class

909.1. Zend\View\Helper\DeclareVars

Helper for declaring default values of template variables

909.1.1. Methods

909.1.1.1. __invoke

__invoke()

Declare template vars to set default values and avoid notices when using strictVars

Primarily for use when using {@link Zend_View_Abstract::strictVars() Zend_View strictVars()}, this helper can be used to declare template variables that may or may not already be set in the view object, as well as to set default values. Arrays passed as arguments to the method will be used to set default values; otherwise, if the variable does not exist, it is set to an empty string.

Usage: <code> $this->declareVars(

‘varName1’, ‘varName2’, array(‘varName3’ => ‘defaultValue’,

‘varName4’ => array()

)

); </code>

Parameters:string|array – number of arguments, all string names of variables to test
Return type:void

909.1.1.2. declareVar

declareVar()

Set a view variable

Checks to see if a $key is set in the view object; if not, sets it to $value.

Parameters:
  • string
  • string – Defaults to an empty string
Return type:

void

Project Versions

Table Of Contents

Previous topic

908. Class

Next topic

910. Class

This Page