HtmlHelper Class Reference

Inheritance diagram for HtmlHelper:

AppHelper Helper Helper Overloadable Overloadable Object Object Object Object List of all members.

Public Member Functions

 __nestedListItem ($items, $attributes, $itemAttributes, $tag)
 addCrumb ($name, $link=null, $options=null)
 charset ($charset=null)
 css ($path, $rel=null, $htmlAttributes=array(), $inline=true)
 div ($class=null, $text=null, $attributes=array(), $escape=false)
 docType ($type= 'xhtml-strict')
 getCrumbs ($separator= '»', $startText=false)
 image ($path, $options=array())
 link ($title, $url=null, $htmlAttributes=array(), $confirmMessage=false, $escapeTitle=true)
 meta ($type, $url=null, $attributes=array(), $inline=true)
 nestedList ($list, $attributes=array(), $itemAttributes=array(), $tag= 'ul')
 para ($class, $text, $attributes=array(), $escape=false)
 style ($data, $inline=true)
 tableCells ($data, $oddTrOptions=null, $evenTrOptions=null, $useCount=false, $continueOddEven=true)
 tableHeaders ($names, $trOptions=null, $thOptions=null)
 tag ($name, $text=null, $attributes=array(), $escape=false)

Public Attributes

 $__docTypes
 $_crumbs = array()
 $action = null
 $base = null
 $data = null
 $here = null
 $params = array()
 $tags

Detailed Description

Definition at line 33 of file html.php.


Member Function Documentation

HtmlHelper::__nestedListItem ( items,
attributes,
itemAttributes,
tag 
)

Internal function to build a nested list (UL/OL) out of an associative array.

Parameters:
array $list Set of elements to list
array $attributes Additional HTML attributes of the list (ol/ul) tag
array $itemAttributes Additional HTML attributes of the list item (LI) tag
string $tag Type of list tag to use (ol/ul)
Returns:
string The nested list element private
See also:
nestedList()

Definition at line 624 of file html.php.

References $out.

HtmlHelper::addCrumb ( name,
link = null,
options = null 
)

Adds a link to the breadcrumbs array.

Parameters:
string $name Text for link
string $link URL for link (if empty it won't be a link)
mixed $options Link attributes e.g. array('id'=>'selected')

Definition at line 165 of file html.php.

HtmlHelper::charset ( charset = null  ) 

Returns a charset META-tag.

Parameters:
string $charset The character set to be used in the meta tag. Example: "utf-8".
Returns:
string A meta tag containing the specified character set.

Definition at line 257 of file html.php.

References Helper::output(), and Configure::read().

HtmlHelper::css ( path,
rel = null,
htmlAttributes = array(),
inline = true 
)

Creates a link element for CSS stylesheets.

Parameters:
mixed $path The name of a CSS style sheet or an array containing names of CSS stylesheets. If `$path` is prefixed with '/', the path will be relative to the webroot of your application. Otherwise, the path will be relative to your CSS path, usually webroot/css.
string $rel Rel attribute. Defaults to "stylesheet". If equal to 'import' the stylesheet will be imported.
array $htmlAttributes Array of HTML attributes.
boolean $inline If set to false, the generated tag appears in the head tag of the layout.
Returns:
string CSS <link> or <style> tag, depending on the type of link.

Definition at line 327 of file html.php.

References $out, $path, and $url.

HtmlHelper::div ( class = null,
text = null,
attributes = array(),
escape = false 
)

Returns a formatted DIV tag for HTML FORMs.

Parameters:
string $class CSS class name of the div element.
string $text String content that will appear inside the div element. If null, only a start tag will be printed
array $attributes Additional HTML attributes of the DIV tag
boolean $escape If true, $text will be HTML-escaped
Returns:
string The formatted DIV element

Definition at line 566 of file html.php.

HtmlHelper::docType ( type = 'xhtml-strict'  ) 

Returns a doctype string.

Possible doctypes: + html4-strict: HTML4 Strict. + html4-trans: HTML4 Transitional. + html4-frame: HTML4 Frameset. + xhtml-strict: XHTML1 Strict. + xhtml-trans: XHTML1 Transitional. + xhtml-frame: XHTML1 Frameset. + xhtml11: XHTML1.1.

Parameters:
string $type Doctype to use.
Returns:
string Doctype.

Definition at line 183 of file html.php.

References Helper::output().

HtmlHelper::getCrumbs ( separator = '&raquo;',
startText = false 
)

Returns the breadcrumb trail as a sequence of -separated links.

Parameters:
string $separator Text to separate crumbs.
string $startText This will be the first crumb, if false it defaults to first crumb in array
Returns:
string

Definition at line 408 of file html.php.

References $out.

HtmlHelper::image ( path,
options = array() 
)

Creates a formatted IMG element.

Parameters:
string $path Path to the image file, relative to the app/webroot/img/ directory.
array $options Array of HTML attributes.
Returns:
string

Definition at line 434 of file html.php.

References Configure::read().

Referenced by meta().

HtmlHelper::link ( title,
url = null,
htmlAttributes = array(),
confirmMessage = false,
escapeTitle = true 
)

Creates an HTML link.

If $url starts with "http://" this is treated as an external link. Else, it is treated as a path to controller/action and parsed with the HtmlHelper::url() method.

If the $url is empty, $title is used instead.

Parameters:
string $title The content to be wrapped by tags.
mixed $url Cake-relative URL or array of URL parameters, or external URL (starts with http://)
array $htmlAttributes Array of HTML attributes.
string $confirmMessage JavaScript confirmation message.
boolean $escapeTitle Whether or not $title should be HTML escaped.
Returns:
string An element.

Definition at line 279 of file html.php.

References $url, Helper::_parseAttributes(), Helper::output(), and Helper::url().

Referenced by meta().

HtmlHelper::meta ( type,
url = null,
attributes = array(),
inline = true 
)

Creates a link to an external resource and handles basic meta tags

Parameters:
string $type The title of the external resource
mixed $url The address of the external resource or string for content attribute
array $attributes Other attributes for the generated tag. If the type attribute is html, rss, atom, or icon, the mime-type is returned.
boolean $inline If set to false, the generated tag appears in the head tag of the layout.
Returns:
string

Definition at line 198 of file html.php.

References $out, $url, Helper::_parseAttributes(), ext(), ClassRegistry::getObject(), image(), link(), name(), Helper::output(), Helper::url(), and Helper::webroot().

HtmlHelper::nestedList ( list,
attributes = array(),
itemAttributes = array(),
tag = 'ul' 
)

Build a nested list (UL/OL) out of an associative array.

Parameters:
array $list Set of elements to list
array $attributes Additional HTML attributes of the list (ol/ul) tag or if ul/ol use that as tag
array $itemAttributes Additional HTML attributes of the list item (LI) tag
string $tag Type of list tag to use (ol/ul)
Returns:
string The nested list public

Definition at line 605 of file html.php.

HtmlHelper::para ( class,
text,
attributes = array(),
escape = false 
)

Returns a formatted P tag.

Parameters:
string $class CSS class name of the p element.
string $text String content that will appear inside the p element.
array $attributes Additional HTML attributes of the P tag
boolean $escape If true, $text will be HTML-escaped
Returns:
string The formatted P element

Definition at line 581 of file html.php.

HtmlHelper::style ( data,
inline = true 
)

Builds CSS style data from an array of CSS properties

Parameters:
array $data Style data array
boolean $inline Whether or not the style block should be displayed inline
Returns:
string CSS styling data

Definition at line 388 of file html.php.

References $out.

HtmlHelper::tableCells ( data,
oddTrOptions = null,
evenTrOptions = null,
useCount = false,
continueOddEven = true 
)

Returns a formatted string of table rows (TR's with TD's in them).

Parameters:
array $data Array of table data
array $oddTrOptions HTML options for odd TR elements if true useCount is used
array $evenTrOptions HTML options for even TR elements
bool $useCount adds class "column-$i"
bool $continueOddEven If false, will use a non-static $count variable, so that the odd/even count is reset to zero just for that call
Returns:
string Formatted HTML

Definition at line 491 of file html.php.

References $out.

HtmlHelper::tableHeaders ( names,
trOptions = null,
thOptions = null 
)

Returns a row of formatted and named TABLE headers.

Parameters:
array $names Array of tablenames.
array $trOptions HTML options for TR elements.
array $thOptions HTML options for TH elements.
Returns:
string

Definition at line 473 of file html.php.

References $out.

HtmlHelper::tag ( name,
text = null,
attributes = array(),
escape = false 
)

Returns a formatted block tag, i.e DIV, SPAN, P.

Parameters:
string $name Tag name.
string $text String content that will appear inside the div element. If null, only a start tag will be printed
array $attributes Additional HTML attributes of the DIV tag
boolean $escape If true, $text will be HTML-escaped
Returns:
string The formatted tag element

Definition at line 542 of file html.php.


Member Data Documentation

HtmlHelper::$__docTypes

Initial value:

 array(
        'html4-strict'  => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
        'html4-trans'  => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
        'html4-frame'  => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
        'xhtml-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
        'xhtml-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
        'xhtml-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
        'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'
    )

Definition at line 149 of file html.php.

HtmlHelper::$_crumbs = array()

Definition at line 142 of file html.php.

HtmlHelper::$action = null

Reimplemented from Helper.

Definition at line 122 of file html.php.

HtmlHelper::$base = null

Reimplemented from Helper.

Definition at line 104 of file html.php.

HtmlHelper::$data = null

Reimplemented from Helper.

Definition at line 128 of file html.php.

HtmlHelper::$here = null

Reimplemented from Helper.

Definition at line 110 of file html.php.

HtmlHelper::$params = array()

Reimplemented from Helper.

Definition at line 116 of file html.php.

HtmlHelper::$tags

Reimplemented from Helper.

Definition at line 45 of file html.php.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:56 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7