[ Index ]
 

Code source de CakePHP 1.1.13.4450

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/cake/libs/view/helpers/ -> html.php (sommaire)

Html Helper class file. Simplifies the construction of HTML elements.

Copyright: Copyright 2005-2007, Cake Software Foundation, Inc.
License: http://www.opensource.org/licenses/mit-license.php The MIT License
Version: $Revision: 4409 $
Poids: 1235 lignes (46 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

HtmlHelper:: (55 méthodes):
  addCrumb()
  charset()
  url()
  link()
  submit()
  password()
  textarea()
  checkbox()
  css()
  file()
  getCrumbs()
  hidden()
  image()
  input()
  selectTag()
  radio()
  dayOptionTag()
  yearOptionTag()
  monthOptionTag()
  hourOptionTag()
  minuteOptionTag()
  meridianOptionTag()
  dateTimeOptionTag()
  tableHeaders()
  tableCells()
  guiListTree()
  tagValue()
  tagIsInvalid()
  validate()
  validateErrors()
  tagErrorMsg()
  setFormTag()
  _parseAttributes()
  areaTag()
  charsetTag()
  checkboxTag()
  cssTag()
  fileTag()
  hiddenTag()
  imageTag()
  inputTag()
  linkOut()
  linkTo()
  parseHtmlOptions()
  passwordTag()
  radioTags()
  urlFor()
  submitTag()
  trim()
  javascriptIncludeTag()
  javascriptTag()
  formTag()
  linkEmail()
  tag()
  contentTag()


Classe: HtmlHelper  - X-Ref

Html Helper class for easy use of HTML widgets.

HtmlHelper encloses all methods needed while working with HTML pages.

addCrumb($name, $link)   X-Ref
Adds a link to the breadcrumbs array.

param: string $name Text for link
param: string $link URL for link
return: void

charset($charset, $return = false)   X-Ref
Returns a charset META-tag.

param: string  $charset
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

url($url = null, $return = false)   X-Ref
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.

param: string  $url        Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4"
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

link($title, $url = null, $htmlAttributes = array()   X-Ref
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.

param: string  $title The content of the A tag.
param: string  $url Cake-relative URL, or external URL (starts with http://)
param: array    $htmlAttributes Array of HTML attributes.
param: string  $confirmMessage Confirmation message.
param: boolean $escapeTitle    Whether or not the text in the $title variable should be HTML escaped.
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

submit($caption = 'Submit', $htmlAttributes = array()   X-Ref
Creates a submit widget.

param: string  $caption Text on submit button
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

password($fieldName, $htmlAttributes = array()   X-Ref
Creates a password input widget.

param: string  $fieldName Name of a field, like this "Modelname/fieldname"
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

textarea($fieldName, $htmlAttributes = array()   X-Ref
Creates a textarea widget.

param: string  $fieldName Name of a field, like this "Modelname/fieldname"
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return    Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

checkbox($fieldName, $title = null, $htmlAttributes = array()   X-Ref
Creates a checkbox widget.

param: string  $fieldName Name of a field, like this "Modelname/fieldname"
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return    Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

css($path, $rel = 'stylesheet', $htmlAttributes = array()   X-Ref
Creates a link element for CSS stylesheets.

param: string $path Path to CSS file
param: string $rel Rel attribute. Defaults to "stylesheet".
param: array $htmlAttributes Array of HTML attributes.
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed Either string or echos the value, depends on AUTO_OUTPUT and $return.

file($fieldName, $htmlAttributes = array()   X-Ref
Creates file input widget.

param: string $fieldName Name of a field, like this "Modelname/fieldname"
param: array $htmlAttributes Array of HTML attributes.
param: boolean $return Wheter this method should return a valueor output it. This overrides AUTO_OUTPUT.
return: mixed Either string or echos the value, depends on AUTO_OUTPUT and $return.

getCrumbs($separator = '»', $startText = false, $return = false)   X-Ref
Returns the breadcrumb trail as a sequence of »-separated links.

param: string  $separator Text to separate crumbs.
param: string  $startText This will be the first crumb, if false it defaults to first crumb in array
param: boolean $return    Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return. If $this->_crumbs is empty, return null.

hidden($fieldName, $htmlAttributes = array()   X-Ref
Creates a hidden input field.

param: string  $fieldName Name of a field, like this "Modelname/fieldname"
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return    Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT  and $return.

image($path, $htmlAttributes = array()   X-Ref
Creates a formatted IMG element.

param: string $path Path to the image file, relative to the webroot/img/ directory.
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

input($fieldName, $htmlAttributes = array()   X-Ref
Creates a text input widget.

param: string $fieldNamem Name of a field, like this "Modelname/fieldname"
param: array $htmlAttributes Array of HTML attributes.
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed Either string or echos the value, depends on AUTO_OUTPUT and $return.

selectTag($fieldName, $optionElements, $selected = null, $selectAttr = array()   X-Ref
Returns a formatted SELECT element.

param: string $fieldName Name attribute of the SELECT
param: array $optionElements Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element
param: mixed $selected Selected option
param: array $selectAttr Array of HTML options for the opening SELECT element
param: array $optionAttr Array of HTML options for the enclosed OPTION elements
param: boolean $show_empty If true, the empty select option is shown
param: boolean $return         Whether this method should return a value
return: string Formatted SELECT element

radio($fieldName, $options, $inbetween = null, $htmlAttributes = array()   X-Ref
Creates a set of radio widgets.

param: string  $fieldName Name of a field, like this "Modelname/fieldname"
param: array    $options            Radio button options array
param: array    $inbetween        String that separates the radio buttons.
param: array    $htmlAttributes Array of HTML attributes.
param: boolean $return    Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return.

dayOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a SELECT element for days.

param: string $tagName Prefix name for the SELECT element
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
param: boolean $showEmpty Show/hide the empty select option
return: mixed

yearOptionTag($tagName, $value = null, $minYear = null, $maxYear = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a SELECT element for years

param: string $tagName Prefix name for the SELECT element
param: integer $minYear First year in sequence
param: integer $maxYear Last year in sequence
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
param: boolean $showEmpty Show/hide the empty select option
return: mixed

monthOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a SELECT element for months.

param: string $tagName Prefix name for the SELECT element
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
param: boolean $showEmpty Show/hide the empty select option
return: mixed

hourOptionTag($tagName, $value = null, $format24Hours = false, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a SELECT element for hours.

param: string $tagName Prefix name for the SELECT element
param: boolean $format24Hours True for 24 hours format
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
return: mixed

minuteOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a SELECT element for minutes.

param: string $tagName Prefix name for the SELECT element
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
return: mixed

meridianOptionTag($tagName, $value = null, $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a SELECT element for AM or PM.

param: string $tagName Prefix name for the SELECT element
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
return: mixed

dateTimeOptionTag($tagName, $dateFormat = 'DMY', $timeFormat = '12', $selected = null, $selectAttr = null, $optionAttr = null, $showEmpty = true)   X-Ref
Returns a set of SELECT elements for a full datetime setup: day, month and year, and then time.

param: string $tagName Prefix name for the SELECT element
param: string $dateFormat DMY, MDY, YMD or NONE.
param: string $timeFormat 12, 24, NONE
param: string $selected Option which is selected.
param: array $optionAttr Attribute array for the option elements.
return: string The HTML formatted OPTION element

tableHeaders($names, $trOptions = null, $thOptions = null, $return = false)   X-Ref
Returns a row of formatted and named TABLE headers.

param: array $names        Array of tablenames.
param: array $trOptions    HTML options for TR elements.
param: array $thOptions    HTML options for TH elements.
param: boolean $return    Wheter this method should return a value
return: string

tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $return = false)   X-Ref
Returns a formatted string of table rows (TR's with TD's in them).

param: array $data        Array of table data
param: array $oddTrOptionsHTML options for odd TR elements
param: array $evenTrOptionsHTML options for even TR elements
param: boolean $return    Wheter this method should return a value
return: string    Formatted HTML

guiListTree($data, $htmlAttributes = array()   X-Ref
Generates a nested unordered list tree from an array.

param: array    $data
param: array    $htmlAttributes
param: string  $bodyKey
param: string  $childrenKey
param: boolean $return Wheter this method should return a value or output it. This overrides AUTO_OUTPUT.
return: mixed    Either string or echos the value, depends on AUTO_OUTPUT and $return. If $this->_crumbs is empty, return null.

tagValue($fieldName)   X-Ref
Returns value of $fieldName. False if the tag does not exist.

param: string $fieldName        Fieldname as "Modelname/fieldname" string
return: string htmlspecialchars Value of the named tag.

tagIsInvalid($model, $field)   X-Ref
Returns false if given FORM field has no errors. Otherwise it returns the constant set in the array Model->validationErrors.

param: string $model Model name as string
param: string $field        Fieldname as string
return: boolean True on errors.

validate()   X-Ref
Returns number of errors in a submitted FORM.

return: int Number of errors

validateErrors()   X-Ref
Validates a FORM according to the rules set up in the Model.

return: int Number of errors

tagErrorMsg($field, $text)   X-Ref
Returns a formatted error message for given FORM field, NULL if no errors.

param: string $field A field name, like "Modelname/fieldname"
param: string $text        Error message
return: string If there are errors this method returns an error message, else NULL.

setFormTag($tagValue)   X-Ref
Sets this helper's model and field properties to the slash-separated value-pair in $tagValue.

param: string $tagValue A field name, like "Modelname/fieldname"
return:

_parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null)   X-Ref
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.

param: array  $options Array of options.
param: array  $exclude Array of options to be excluded.
param: string $insertBefore String to be inserted before options.
param: string $insertAfter  String to be inserted ater options.
return: string

areaTag($tagName, $cols = 60, $rows = 10, $htmlAttributes = array()   X-Ref


charsetTag($charset, $return = false)   X-Ref


checkboxTag($fieldName, $title = null, $htmlAttributes = array()   X-Ref


cssTag($path, $rel = 'stylesheet', $htmlAttributes = array()   X-Ref


fileTag($fieldName, $htmlAttributes = array()   X-Ref


hiddenTag($tagName, $value = null, $htmlOptions = null)   X-Ref


imageTag($path, $alt = null, $htmlAttributes = array()   X-Ref


inputTag($tagName, $size = 20, $htmlOptions = null)   X-Ref


linkOut($title, $url = null, $htmlAttributes = array()   X-Ref


linkTo($title, $url, $htmlAttributes = array()   X-Ref


parseHtmlOptions($options, $exclude = null, $insertBefore = ' ', $insertAfter = null)   X-Ref


passwordTag($fieldName, $size = 20, $htmlAttributes = array()   X-Ref


radioTags($fieldName, $options, $inbetween = null, $htmlAttributes = array()   X-Ref


urlFor($url)   X-Ref


submitTag()   X-Ref


trim()   X-Ref


javascriptIncludeTag($url)   X-Ref


javascriptTag($script)   X-Ref


formTag($target = null, $type = 'post', $htmlAttributes = array()   X-Ref
This is very WYSIWYG unfriendly, use HtmlHelper::url() to get contents of "action" attribute. Version 0.9.2.


linkEmail($title, $email = null, $options = null)   X-Ref
This should be done using a content filter.


tag($name, $options = null, $open = false)   X-Ref


contentTag($name, $content, $options = null)   X-Ref




Généré le : Sun Feb 25 19:27:47 2007 par Balluche grâce à PHPXref 0.7