HtmlHelper Class Reference

Inheritance diagram for HtmlHelper:

AppHelper Helper Helper Overloadable Overloadable Object Object Object Object

List of all members.


Public Member Functions

 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

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

Detailed Description

Definition at line 35 of file html.php.


Member Function Documentation

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 167 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 259 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 in /app/webroot/css, or an array containing names of CSS stylesheets in that directory.
string $rel Rel attribute. Defaults to "stylesheet".
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 325 of file html.php.

References $out, 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 561 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 185 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 402 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 $htmlAttributes Array of HTML attributes.
Returns:
string

Definition at line 428 of file html.php.

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 $title 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 200 of file html.php.

References $out, $url, Helper::_parseAttributes(), ClassRegistry::getObject(), image(), link(), 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 600 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 576 of file html.php.

HtmlHelper::style ( data,
inline = true 
)

Builds CSS style data from an array of CSS properties

Parameters:
array $data
Returns:
string CSS styling data

Definition at line 382 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 486 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 468 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 537 of file html.php.


Member Data Documentation

HtmlHelper::$_crumbs = array()

Definition at line 144 of file html.php.

HtmlHelper::$action = null

Reimplemented from Helper.

Definition at line 124 of file html.php.

HtmlHelper::$base = null

Reimplemented from Helper.

Definition at line 106 of file html.php.

HtmlHelper::$data = null

Reimplemented from Helper.

Definition at line 130 of file html.php.

HtmlHelper::$here = null

Reimplemented from Helper.

Definition at line 112 of file html.php.

HtmlHelper::$params = array()

Reimplemented from Helper.

Definition at line 118 of file html.php.

HtmlHelper::$tags

Reimplemented from Helper.

Definition at line 47 of file html.php.


The documentation for this class was generated from the following file: