Class Zend_View_Helper_DeclareVars


Helper for declaring default values of template variables

  • copyright: Copyright (c) 2005-2008 Zend Technologies USA Inc. (
  • license: New BSD License

Located in /View/Helper/DeclareVars.php (line 34)

Variable Summary
Method Summary
 void declareVars (string|array 0)
 void _declareVar (string $key, [string $value = ''])
Zend_View $view (line 40)

The view object that created this helper object.

  • access: public

Redefinition of:
View object
declareVars (line 66)

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

Primarily for use when using 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.


  1.  $this->declareVars(
  2.      'varName1',
  3.      'varName2',
  4.      array('varName3' => 'defaultValue',
  5.            'varName4' => array()
  6.      )
  7.  );

  • access: public
void declareVars (string|array 0)
  • string|array 0: variable number of arguments, all string names of variables to test
_declareVar (line 89)

Set a view variable

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

  • access: protected
void _declareVar (string $key, [string $value = ''])
  • string $key
  • string $value: Defaults to an empty string

Inherited Methods

Inherited From Zend_View_Helper_Abstract


Documentation generated on Fri, 08 Jan 2010 16:10:46 -0500 by phpDocumentor 1.4.3