Documentation

Horde_View_Helper_Tag extends Horde_View_Helper_Base
in package

Use these methods to generate HTML tags programmatically.

By default, they output HTML 4.01 Strict compliant tags.

Tags
author

Mike Naberezny mike@maintainable.com

author

Derek DeVries derek@maintainable.com

author

Chuck Hagenbuch chuck@horde.org

license

http://www.horde.org/licenses/bsd

category

Horde

subpackage

Helper

Table of Contents

$_view  : Horde_View
The parent view invoking the helper.
$_booleanAttributes  : array<string|int, mixed>
Boolean HTML attributes.
__call()  : mixed
Call chaining so members of the view can be called (including other helpers).
__construct()  : mixed
Creates a helper for $view.
__get()  : mixed
Proxy on undefined property access (get).
__set()  : mixed
Proxy on undefined property access (set).
cdataSection()  : string
Returns a CDATA section with the given $content.
contentTag()  : string
Returns an HTML block tag of type $name surrounding the $content.
escape()  : string
Escapes a value for output in a view template.
escapeOnce()  : string
Returns the escaped $html without affecting existing escaped entities.
tag()  : string
Returns an empty HTML tag of type $name.
tagOptions()  : string
Converts an associative array of $options into a string of HTML attributes.
_fixDoubleEscape()  : string
Fix double-escaped entities, such as &amp;amp;, &amp;#123;, etc.

Properties

$_booleanAttributes

Boolean HTML attributes.

private array<string|int, mixed> $_booleanAttributes = array('checked', 'disabled', 'multiple', 'readonly', 'selected')

Methods

__call()

Call chaining so members of the view can be called (including other helpers).

public __call(string $method, array<string|int, mixed> $args) : mixed
Parameters
$method : string

The method.

$args : array<string|int, mixed>

The parameters for the method.

Return values
mixed

The result of the method.

__construct()

Creates a helper for $view.

public __construct(Horde_View $view) : mixed
Parameters
$view : Horde_View

The view to help.

Return values
mixed

__get()

Proxy on undefined property access (get).

public __get(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

__set()

Proxy on undefined property access (set).

public __set(mixed $name, mixed $value) : mixed
Parameters
$name : mixed
$value : mixed
Return values
mixed

cdataSection()

Returns a CDATA section with the given $content.

public cdataSection(string $content) : string

CDATA sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string "".

$this->cdataSection(''); // => ]]>
Parameters
$content : string

Content for inside CDATA section.

Return values
string

CDATA section with content.

contentTag()

Returns an HTML block tag of type $name surrounding the $content.

public contentTag(string $name, string $content[, array<string|int, mixed> $options = null ]) : string

Add HTML attributes by passing an attributes hash to $options. For attributes with no value (like disabled and readonly), give it a value of TRUE in the $options array.

$this->contentTag('p', 'Hello world!') // =>

Hello world!

$this->contentTag('div', $this->contentTag('p', 'Hello world!'), array('class' => 'strong')) // =>

Hello world!

$this->contentTag('select', $options, array('multiple' => true)) // =>
Parameters
$name : string

Tag name.

$content : string

Content to place between the tags.

$options : array<string|int, mixed> = null

Tag attributes.

Return values
string

Generated HTML tags with content between.

escape()

Escapes a value for output in a view template.

public escape(string $var) : string

escape($this->templateVar) ?>

Parameters
$var : string

The output to escape.

Return values
string

The escaped value.

escapeOnce()

Returns the escaped $html without affecting existing escaped entities.

public escapeOnce(string $html) : string
$this->escapeOnce('1 > 2 & 3') // => '1 < 2 & 3'
Parameters
$html : string

HTML to be escaped.

Return values
string

Escaped HTML without affecting existing escaped entities.

tag()

Returns an empty HTML tag of type $name.

public tag(string $name[, string $options = null ]) : string

Add HTML attributes by passing an attributes hash to $options. For attributes with no value (like disabled and readonly), give it a value of TRUE in the $options array.

$this->tag('br') // =>
$this->tag('input', array('type' => 'text', 'disabled' => true)) // =>
Parameters
$name : string

Tag name.

$options : string = null

Tag attributes.

Return values
string

Generated HTML tag.

tagOptions()

Converts an associative array of $options into a string of HTML attributes.

public tagOptions(array<string|int, mixed> $options) : string
Parameters
$options : array<string|int, mixed>

Key/value pairs.

Return values
string

'key1="value1" key2="value2"'

_fixDoubleEscape()

Fix double-escaped entities, such as &amp;amp;, &amp;#123;, etc.

private _fixDoubleEscape(string $escaped) : string
Parameters
$escaped : string

Double-escaped entities.

Return values
string

Entities fixed.

Search results