Overview

Packages

  • View
    • Helper

Classes

  • Horde_View_Helper_Base
  • Horde_View_Helper_Benchmark
  • Horde_View_Helper_Benchmark_Timer
  • Horde_View_Helper_Block
  • Horde_View_Helper_Capture
  • Horde_View_Helper_Capture_Base
  • Horde_View_Helper_Capture_ContentFor
  • Horde_View_Helper_Date
  • Horde_View_Helper_Debug
  • Horde_View_Helper_Form
  • Horde_View_Helper_Form_Builder
  • Horde_View_Helper_Form_InstanceTag_Base
  • Horde_View_Helper_Form_InstanceTag_Form
  • Horde_View_Helper_FormTag
  • Horde_View_Helper_Javascript
  • Horde_View_Helper_Number
  • Horde_View_Helper_Tag
  • Horde_View_Helper_Text
  • Horde_View_Helper_Text_Cycle
  • Horde_View_Helper_Url
  • Overview
  • Package
  • Class
  • Tree

Class Horde_View_Helper_Tag

Use these methods to generate HTML tags programmatically.

By default, they output HTML 4.01 Strict compliant tags.

Horde_View_Helper_Base
Extended by Horde_View_Helper_Tag

Direct known subclasses

Horde_View_Helper_Form_InstanceTag_Base

Indirect known subclasses

Horde_View_Helper_Form_InstanceTag_Form
Package: View\Helper
Category: Horde
License: http://www.horde.org/licenses/bsd
Author: Mike Naberezny mike@maintainable.com
Author: Derek DeVries derek@maintainable.com
Author: Chuck Hagenbuch chuck@horde.org
Located at Horde/View/Helper/Tag.php
Methods summary
public string
# tag( string $name, string $options = null )

Returns an empty HTML tag of type $name.

Returns an empty HTML tag of type $name.

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')
// => <br>
$this->tag('input', array('type' => 'text', 'disabled' => true))
// => <input type="text" disabled="disabled">

Parameters

$name
Tag name.
$options
Tag attributes.

Returns

string
Generated HTML tag.
public string
# contentTag( string $name, string $content, array $options = null )

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

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

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!')
// => <p>Hello world!</p>
$this->contentTag('div',
                  $this->contentTag('p', 'Hello world!'),
                  array('class' => 'strong'))
// => <div class="strong"><p>Hello world!</p></div>
$this->contentTag('select', $options, array('multiple' => true))
// => <select multiple="multiple">...options...</select>

Parameters

$name
Tag name.
$content
Content to place between the tags.
$options
Tag attributes.

Returns

string
Generated HTML tags with content between.
public string
# cdataSection( string $content )

Returns a CDATA section with the given $content.

Returns a CDATA section with the given $content.

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
Content for inside CDATA section.

Returns

string
CDATA section with content.
public string
# escape( string $var )

Escapes a value for output in a view template.

Escapes a value for output in a view template.

<p><?php echo $this->escape($this->templateVar) ?></p>

Parameters

$var
The output to escape.

Returns

string
The escaped value.
public string
# escapeOnce( string $html )

Returns the escaped $html without affecting existing escaped entities.

Returns the escaped $html without affecting existing escaped entities.

$this->escapeOnce('1 > 2 & 3') // => '1 < 2 & 3'

Parameters

$html
HTML to be escaped.

Returns

string
Escaped HTML without affecting existing escaped entities.
public string
# tagOptions( array $options )

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

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

Parameters

$options
Key/value pairs.

Returns

string
'key1="value1" key2="value2"'
Methods inherited from Horde_View_Helper_Base
__call(), __construct(), __get(), __set()
API documentation generated by ApiGen