HtmlHelper Class Info:

Class Declaration:
class HtmlHelper extends AppHelper
File name:
cake/libs/view/helpers/html.php
Summary:
Html Helper class for easy use of HTML widgets. HtmlHelper encloses all methods needed while working with HTML pages.
Class Inheritance

AppHelper Helper Overloadable Object

package
cake
subpackage
cake.cake.libs.view.helpers

Properties:

Show/Hide parent properties
public action Current action.
public argSeparator URL argument separator character
public base Base URL
public data Enter description here...
public helpers List of helpers used by this helper
public here URL to current action.
protected _log Log object
public namedArgs List of named arguments
public params Parameter array.
public plugin Plugin path
public tags html tags used by this helper.
public themeWeb Theme name
public validationErrors Contains model validation errors of form post-backs
public webroot Webroot path

Method Summary:

Show/Hide parent methods
public addClass( $options = array ( ), $class = NULL, $key = 'class' )
public addCrumb( $name, $link = NULL, $options = NULL )
public afterLayout( )
public afterRender( )
public beforeLayout( )
public beforeRender( )
public cakeError( $method, $messages = array ( ) )
public call__( $method, $params )
public charset( $charset = NULL )
public clean( $output )
public __construct( )
public css( $path, $rel = NULL, $htmlAttributes = array ( ), $inline = true )
public dispatchMethod( $method, $params = array ( ) )
public div( $class = NULL, $text = NULL, $attributes = array ( ), $escape = false )
public docType( $type = 'xhtml-strict' )
public domId( $options = NULL, $id = 'id' )
public field( )
protected get__( $name )
public getCrumbs( $separator = '»', $startText = false )
public image( $path, $options = array ( ) )
protected _initInputField( $field, $options = array ( ) )
public link( $title, $url = NULL, $htmlAttributes = array ( ), $confirmMessage = false, $escapeTitle = true )
public loadConfig( $name = 'tags' )
public log( $msg, $type = 2 )
public meta( $type, $url = NULL, $attributes = array ( ), $inline = true )
public model( )
public modelID( )
public __name( $options = array ( ), $field = NULL, $key = 'name' )
public nestedList( $list, $attributes = array ( ), $itemAttributes = array ( ), $tag = 'ul' )
public Object( )
public output( $str )
public overload( )
public para( $class, $text, $attributes = array ( ), $escape = false )
public _parseAttributes( $options, $exclude = NULL, $insertBefore = ' ', $insertAfter = NULL )
protected _persist( $name, $return, $object, $type = NULL )
public requestAction( $url, $extra = array ( ) )
protected _savePersistent( $name, $object )
protected _set( $properties = array ( ) )
public set__( $name, $value )
public setEntity( $entity, $setScope = false )
public _stop( $status = 0 )
public style( $data, $inline = true )
public tableCells( $data, $oddTrOptions = NULL, $evenTrOptions = NULL, $useCount = false, $continueOddEven = true )
public tableHeaders( $names, $trOptions = NULL, $thOptions = NULL )
public tag( $name, $text = NULL, $attributes = array ( ), $escape = false )
public tagIsInvalid( $model = NULL, $field = NULL, $modelID = NULL )
public toString( )
public url( $url = NULL, $full = false )
public value( $options = array ( ), $field = NULL, $key = 'value' )
public webroot( $file )

addClass

top
Adds the given class to the element options
Parameters:
$options array optional array ( )
$class string optional NULL
$key string optional 'class'
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 642
return
array

addCrumb

top
Adds a link to the breadcrumbs array.
Parameters:
$name string Text for link required (no default)
$link string URL for link (if empty it won't be a link) optional NULL
$options mixed Link attributes e.g. array('id'=>'selected') optional NULL
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 164

afterLayout

top
After layout callback. Overridden in subclasses.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 683

afterRender

top
After render callback. Overridden in subclasses.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 671

beforeLayout

top
Before layout callback. Overridden in subclasses.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 677

beforeRender

top
Before render callback. Overridden in subclasses.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 665

cakeError

top
Used to report user friendly errors. If there is a file app/error.php or app/app_error.php this file will be loaded error.php is the AppError class it should extend ErrorHandler class.
Parameters:
$method string Method to be called in the error class (AppError or ErrorHandler classes) required (no default)
$messages array Message that is to be displayed by the error class optional array ( )
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 189
return
error message
access
public

call__

top
Parameters:
$method required (no default)
$params required (no default)
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 142

charset

top
Returns a charset META-tag.
Parameters:
$charset string The character set to be used in the meta tag. Example: "utf-8". optional NULL
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 256
return
string A meta tag containing the specified character set.

clean

top
Used to remove harmful tags from content
Parameters:
$output mixed required (no default)
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 214
return
cleaned content for output
access
public

__construct

top
Class constructor, overridden in descendant classes.
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 63

css

top
Creates a link element for CSS stylesheets.
Parameters:
$path mixed 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. required (no default)
$rel string Rel attribute. Defaults to "stylesheet". If equal to 'import' the stylesheet will be imported. optional NULL
$htmlAttributes array Array of HTML attributes. optional array ( )
$inline boolean If set to false, the generated tag appears in the head tag of the layout. optional true
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 326
return
string CSS <link /> or <style /> tag, depending on the type of link.

dispatchMethod

top
Calls a method on this object with the given parameters. Provides an OO wrapper for call_user_func_array, and improves performance by using straight method calls in most cases.
Parameters:
$method string Name of the method to call required (no default)
$params array Parameter list to use when calling $method optional array ( )
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 113
return
mixed Returns the result of the method call
access
public

div

top
Returns a formatted DIV tag for HTML FORMs.
Parameters:
$class string CSS class name of the div element. optional NULL
$text string String content that will appear inside the div element. If null, only a start tag will be printed optional NULL
$attributes array Additional HTML attributes of the DIV tag optional array ( )
$escape boolean If true, $text will be HTML-escaped optional false
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 571
return
string The formatted DIV element

docType

top
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:
$type string Doctype to use. optional 'xhtml-strict'
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 182
return
string Doctype.

domId

top
Generates a DOM ID for the selected element, if one is not set.
Parameters:
$options mixed optional NULL
$id string optional 'id'
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 483
return
mixed

field

top
Gets the currently-used model field of the rendering context.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 445
return
string

get__

top
Default overload methods
Parameters:
$name required (no default)
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 140
access
protected

getCrumbs

top
Returns the breadcrumb trail as a sequence of &raquo;-separated links.
Parameters:
$separator string Text to separate crumbs. optional '»'
$startText string This will be the first crumb, if false it defaults to first crumb in array optional false
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 411
return
string

image

top
Creates a formatted IMG element.
Parameters:
$path string Path to the image file, relative to the app/webroot/img/ directory. required (no default)
$options array Array of HTML attributes. optional array ( )
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 437
return
string

_initInputField

top
Sets the defaults for an input tag
Parameters:
$field required (no default)
$options array optional array ( )
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 621
return
array
access
protected

link

top
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:
$title string The content to be wrapped by <a> tags. required (no default)
$url mixed Cake-relative URL or array of URL parameters, or external URL (starts with http://) optional NULL
$htmlAttributes array Array of HTML attributes. optional array ( )
$confirmMessage string JavaScript confirmation message. optional false
$escapeTitle boolean Whether or not $title should be HTML escaped. optional true
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 278
return
string An <a /> element.

loadConfig

top
Parses tag templates into $this->tags.
Parameters:
$name optional 'tags'
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 152
return
array merged tags from config/$name.php

log

top
API for logging events.
Parameters:
$msg string Log message required (no default)
$type integer Error type constant. Defined in app/config/core.php. optional 2
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 150
return
boolean Success of log write
access
public

meta

top
Creates a link to an external resource and handles basic meta tags
Parameters:
$type string The title of the external resource required (no default)
$url mixed The address of the external resource or string for content attribute optional NULL
$attributes array Other attributes for the generated tag. If the type attribute is html, rss, atom, or icon, the mime-type is returned. optional array ( )
$inline boolean If set to false, the generated tag appears in the head tag of the layout. optional true
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 197
return
string

model

top
Gets the currently-used model of the rendering context.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 423
return
string

modelID

top
Gets the ID of the currently-used model of the rendering context.
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 436
return
mixed

__name

top
Gets the input field name for the current tag
Parameters:
$options array optional array ( )
$field optional NULL
$key string optional 'name'
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 510
return
array

nestedList

top
Build a nested list (UL/OL) out of an associative array.
Parameters:
$list array Set of elements to list required (no default)
$attributes array Additional HTML attributes of the list (ol/ul) tag or if ul/ol use that as tag optional array ( )
$itemAttributes array Additional HTML attributes of the list item (LI) tag optional array ( )
$tag string Type of list tag to use (ol/ul) optional 'ul'
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 610
return
string The nested list
access
public

Object

top
A hack to support __construct() on PHP 4 Hint: descendant classes have no PHP4 class_name() constructors, so this constructor gets called first and calls the top-layer __construct() which (if present) should call parent::__construct()
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 53
return
Object

output

top
Returns a string generated by a helper method This method can be overridden in subclasses to do generalized output post-processing
Parameters:
$str string String to be output. required (no default)
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 658
return
string

overload

top
Overload implementation. No need for implementation in PHP5.
Method defined in class:
Overloadable
Method defined in file:
cake/libs/overloadable_php5.php on line 39
access
public

para

top
Returns a formatted P tag.
Parameters:
$class string CSS class name of the p element. required (no default)
$text string String content that will appear inside the p element. required (no default)
$attributes array Additional HTML attributes of the P tag optional array ( )
$escape boolean If true, $text will be HTML-escaped optional false
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 586
return
string The formatted P element

_parseAttributes

top
Returns a space-delimited string with items of the $options array. If a key of $options array happens to be one of: + 'compact' + 'checked' + 'declare' + 'readonly' + 'disabled' + 'selected' + 'defer' + 'ismap' + 'nohref' + 'noshade' + 'nowrap' + 'multiple' + 'noresize' And its value is one of: + 1 + true + 'true' Then the value will be reset to be identical with key's name. If the value is not one of these 3, the parameter is not output.
Parameters:
$options array Array of options. required (no default)
$exclude array Array of options to be excluded. optional NULL
$insertBefore string String to be inserted before options. optional ' '
$insertAfter string String to be inserted ater options. optional NULL
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 260
return
string

_persist

top
Checks for a persistent class file, if found file is opened and true returned If file is not found a file is created and false returned If used in other locations of the model you should choose a unique name for the persistent file There are many uses for this method, see manual for examples
Parameters:
$name string name of the class to persist required (no default)
$return required (no default)
$object string the object to persist required (no default)
$type optional NULL
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 219
return
boolean Success
access
protected
todo
add examples to manual

requestAction

top
Calls a controller's method from any location.
Parameters:
$url mixed String or array-based url. required (no default)
$extra array if array includes the key "return" it sets the AutoRender to true. optional array ( )
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 86
return
mixed Boolean true or false on success/failure, or contents of rendered action if 'return' is set in $extra.
access
public

_savePersistent

top
You should choose a unique name for the persistent file There are many uses for this method, see manual for examples
Parameters:
$name string name used for object to cache required (no default)
$object object the object to persist required (no default)
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 247
return
boolean true on save, throws error if file can not be created
access
protected

_set

top
Allows setting of multiple properties of the object in a single line of code.
Parameters:
$properties array An associative array containing properties and corresponding values. optional array ( )
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 169
return
void
access
protected

set__

top
Parameters:
$name required (no default)
$value required (no default)
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 141

setEntity

top
Sets this helper's model and field properties to the dot-separated value-pair in $entity.
Parameters:
$entity mixed A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName" required (no default)
$setScope boolean Sets the view scope to the model specified in $tagValue optional false
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 311
return
void

_stop

top
Stop execution of the current script
Parameters:
$status optional 0
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 139
return
void
access
public

style

top
Builds CSS style data from an array of CSS properties
Parameters:
$data array Style data array required (no default)
$inline boolean Whether or not the style block should be displayed inline optional true
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 391
return
string CSS styling data

tableCells

top
Returns a formatted string of table rows (TR's with TD's in them).
Parameters:
$data array Array of table data required (no default)
$oddTrOptions array HTML options for odd TR elements if true useCount is used optional NULL
$evenTrOptions array HTML options for even TR elements optional NULL
$useCount bool adds class "column-$i" optional false
$continueOddEven bool If false, will use a non-static $count variable, so that the odd/even count is reset to zero just for that call optional true
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 496
return
string Formatted HTML

tableHeaders

top
Returns a row of formatted and named TABLE headers.
Parameters:
$names array Array of tablenames. required (no default)
$trOptions array HTML options for TR elements. optional NULL
$thOptions array HTML options for TH elements. optional NULL
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 478
return
string

tag

top
Returns a formatted block tag, i.e DIV, SPAN, P.
Parameters:
$name string Tag name. required (no default)
$text string String content that will appear inside the div element. If null, only a start tag will be printed optional NULL
$attributes array Additional HTML attributes of the DIV tag optional array ( )
$escape boolean If true, $text will be HTML-escaped optional false
Method defined in class:
HtmlHelper
Method defined in file:
cake/libs/view/helpers/html.php on line 547
return
string The formatted tag element

tagIsInvalid

top
Returns false if given FORM field has no errors. Otherwise it returns the constant set in the array Model->validationErrors.
Parameters:
$model string Model name as string optional NULL
$field string Fieldname as string optional NULL
$modelID integer Unique index identifying this record within the form optional NULL
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 457
return
boolean True on errors.

toString

top
Object-to-string conversion. Each class can override this method as necessary.
Method defined in class:
Object
Method defined in file:
cake/libs/object.php on line 73
return
string The name of this class
access
public

url

top
Finds URL for specified action. Returns an URL pointing to a combination of controller and action. Param $url can be: + Empty - the method will find adress to actuall controller/action. + '/' - the method will find base URL of application. + A combination of controller/action - the method will find url for it.
Parameters:
$url mixed Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4" or an array specifying any of the following: 'controller', 'action', and/or 'plugin', in addition to named arguments (keyed array elements), and standard URL arguments (indexed array elements) optional NULL
$full boolean If true, the full base URL will be prepended to the result optional false
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 177
return
string Full translated URL with base path.

value

top
Gets the data for the current tag
Parameters:
$options array optional array ( )
$field optional NULL
$key string optional 'value'
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 552
return
array
access
public

webroot

top
Checks if a file exists when theme is used, if no file is found default location is returned
Parameters:
$file string required (no default)
Method defined in class:
Helper
Method defined in file:
cake/libs/view/helper.php on line 186
return
string $webPath web path to file.