fooBar().
setHelperPath() to overwrite the existing paths, this
path will be set to ensure the default helpers work.
$this->helperName(). Behind the scenes,
helperName() method. The
object instance is persistent within the $this->helperName().
declareVars(): Primarily for use when using
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.
fieldset($name, $content, $attribs): Creates an
XHTML fieldset. If $attribs contains a 'legend'
key, that value will be used for the fieldset legend. The
fieldset will surround the $content as provided to
the helper.
form($name, $attribs, $content): Generates an XHTML
form. All $attribs are escaped and rendered as
XHTML attributes of the form tag. If $content is
present and not a boolean false, then that content is rendered
within the start and close form tags; if $content
is a boolean false (the default), only the opening form tag is
generated.
formButton($name, $value, $attribs): Creates an
<button /> element.
formCheckbox($name, $value, $attribs,
$options): Creates an <input type="checkbox"
/> element.
formErrors($errors, $options): Generates an
XHTML unordered list to show errors. $errors
should be a string or an array of strings;
$options should be any attributes you want
placed in the opening list tag.
setElementStart($string); default is
'<ul class="errors"%s"><li>', where %s
is replaced with the attributes as specified in
$options.
setElementSeparator($string); default
is '</li><li>'.
setElementEnd($string); default is
'</li></ul>'.
formFile($name, $attribs): Creates an
<input type="file" /> element.
formHidden($name, $value, $attribs): Creates an
<input type="hidden" /> element.
formLabel($name, $value, $attribs): Creates a
<label> element, setting the for attribute to
$name, and the actual label text to
$value. If disable is passed in
attribs, nothing will be returned.
formMultiCheckbox($name, $value, $attribs, $options,
$listsep): Creates a list of checkboxes.
$options should be an associative array, and may be
arbitrarily deep. $value may be a single value or
an array of selected values that match the keys in the
$options array. $listsep is an HTML
break ("<br />") by default. By default, this element is
treated as an array; all checkboxes share the same name, and are
submitted as an array.
formPassword($name, $value, $attribs): Creates an
<input type="password" /> element.
formRadio($name, $value, $attribs, $options):
Creates a series of <input type="radio" /> elements, one
for each of the $options elements. In the $options array, the
element key is the radio value, and the element value is the
radio label. The $value radio will be preselected for you.
formReset($name, $value, $attribs): Creates an
<input type="reset" /> element.
formSelect($name, $value, $attribs, $options):
Creates a <select>...</select> block, with one
<option>one for each of the $options elements. In the
$options array, the element key is the option value, and the
element value is the option label. The $value option(s) will be
preselected for you.
formSubmit($name, $value, $attribs): Creates an
<input type="submit" /> element.
formText($name, $value, $attribs): Creates an
<input type="text" /> element.
formTextarea($name, $value, $attribs): Creates a
<textarea>...</textarea> block.
url($urlOptions, $name, $reset): Creates a URL
string based on a named route. $urlOptions should
be an associative array of key/value pairs used by the
particular route.
htmlList($items, $ordered, $attribs, $escape): generates
unordered and ordered lists based on the $items
passed to it. If $items is a multidimensional
array, a nested list will be built. If the $escape
flag is true (default), individual items will be escaped using
the view objects registered escaping mechanisms; pass a false
value if you want to allow markup in your lists.
setHelperPath() and
addHelperPath() methods. Additionally, you can
indicate a class prefix to use for helpers in the path provided, to
allow namespacing your helper classes. By default, if no class
prefix is provided, 'Zend_View_Helper_' is assumed.
addHelperPath() method. As you add paths to the stack,
setView() method; however, in upcoming releases, we
plan to implement a strategy pattern that will simplify much of
the naming schema detailed below. Building off these now will
help you future-proof your code.
addHelperPath() or
setHelperPath()).
SpecialPurpose helper code:
SpecialPurpose
helper as many times as you like; it will be instantiated once, and
then it persists for the life of that setView($view) method, like the following:
setView() method, it will be
called when the helper class is first instantiated, and passed the
current view object. It is up to you to persist the object in your
class, as well as determine how it should be accessed.