Joomla! Platform 12.1

Abstract Class JHtml

Description

Utility class for all HTML drawing classes

  • abstract:
  • since: 11.1

Located in /libraries/joomla/html/html.php (line 26)

Abstract class JHtml   (Subpackage HTML)
Variable Summary
Static variable static array $formatOptions
Static variable static array $includePaths
Static variable static array $registry
Method Summary
Static method static array addIncludePath ([string $path = ''])
Static method static string calendar (string $value, string $name, string $id, [string $format = '%Y-%m-%d'], [array $attribs = null])
Static method static mixed call (string $function, array $args)
Static method static string date ([string $input = 'now'], [string $format = null], [mixed $tz = true], [boolean $gregorian = false])
Static method static array extract (string $key)
Static method static string iframe (string $url, string $name, [array $attribs = null], [string $noFrames = ''])
Static method static string image (string $file, string $alt, [string $attribs = null], [array $relative = false], [boolean $path_only = false])
Static method static array includeRelativeFiles (string $folder, string $file, boolean $relative, boolean $detect_browser, boolean $detect_debug)
Static method static boolean isRegistered (string $key)
Static method static string link (string $url, string $text, [array $attribs = null])
Static method static boolean register (string $key, string $function)
Static method static mixed script (string $file, [boolean $framework = false], [boolean $relative = false], [boolean $path_only = false], [boolean $detect_browser = true], [boolean $detect_debug = true])
Static method static void setFormatOptions (array $options)
Static method static mixed stylesheet (string $file, [array $attribs = array()], [boolean $relative = false], [boolean $path_only = false], [boolean $detect_browser = true], [boolean $detect_debug = true])
Static method static string tooltip (string $tooltip, [mixed $title = ''], [string $image = 'tooltip.png'], [string $text = ''], [string $href = ''], [string $alt = 'Tooltip'], [string $class = 'hasTip'])
Static method static boolean unregister (string $key)
Static method static mixed _ (string $key)
Variables
array $formatOptions = array('format.depth' => 0, 'format.eol' => "\n", 'format.indent' => "\t") (line 39)

Option values related to the generation of HTML output. Recognized options are: fmtDepth, integer. The current indent depth.

fmtEol, string. The end of line string, default is linefeed. fmtIndent, string. The string to use for indentation, default is tab.

  • since: 11.1
  • access: public
array $includePaths = array() (line 47)

An array to hold included paths

  • since: 11.1
  • access: protected
array $registry = array() (line 55)

An array to hold method references

  • since: 11.1
  • access: protected
Methods
addIncludePath (line 840)

Add a directory where JHtml should search for helpers. You may either pass a string or an array of directories.

  • return: An array with directory elements
  • since: 11.1
  • access: public
array addIncludePath ([string $path = ''])
  • string $path: A path to search.
calendar (line 776)

Displays a calendar control field

  • return: HTML markup for a calendar field
  • since: 11.1
  • access: public
string calendar (string $value, string $name, string $id, [string $format = '%Y-%m-%d'], [array $attribs = null])
  • string $value: The date value
  • string $name: The name of the text field
  • string $id: The id of the text field
  • string $format: The date format
  • array $attribs: Additional HTML attributes
call (line 214)

Function caller method

mixed call (string $function, array $args)
  • string $function: Function or method to call
  • array $args: Arguments to be passed to function
date (line 640)

Returns formated date according to a given format and time zone.

  • return: A date translated by the given format and time zone.
  • see: strftime
  • since: 11.1
  • access: public
string date ([string $input = 'now'], [string $format = null], [mixed $tz = true], [boolean $gregorian = false])
  • string $input: String in a format accepted by date(), defaults to "now".
  • string $format: Format optional format for strftime
  • mixed $tz: Time zone to be used for the date. Special cases: boolean true for user setting, boolean false for server setting.
  • boolean $gregorian: True to use Gregorian calenar
extract (line 67)

Method to extract a key

  • return: Contains lowercase key, prefix, file, function.
  • since: 11.1
  • access: protected
array extract (string $key)
  • string $key: The name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.
iframe (line 265)

Write a <iframe></iframe> element

  • return: <iframe></iframe> element or message if not supported
  • since: 11.1
  • access: public
string iframe (string $url, string $name, [array $attribs = null], [string $noFrames = ''])
  • string $url: The relative URL to use for the src attribute
  • string $name: The target attribute to use
  • array $attribs: An associative array of attributes to add
  • string $noFrames: The message to display if the iframe tag is not supported
image (line 454)

Write a <img></img> element

  • since: 11.1
  • access: public
string image (string $file, string $alt, [string $attribs = null], [array $relative = false], [boolean $path_only = false])
  • string $file: The relative or absolute URL to use for the src attribute
  • string $alt: The alt text.
  • string $attribs: The target attribute to use
  • array $relative: An associative array of attributes to add
  • boolean $path_only: If set to true, it tries to find an override for the file in the template
includeRelativeFiles (line 289)

Compute the files to be included

  • return: files to be included
  • see: JBrowser
  • since: 11.1
  • access: protected
array includeRelativeFiles (string $folder, string $file, boolean $relative, boolean $detect_browser, boolean $detect_debug)
  • string $folder: folder name to search into (images, css, js, ...)
  • string $file: path to file
  • boolean $relative: path to file is relative to /media folder
  • boolean $detect_browser: detect browser to include specific browser files
  • boolean $detect_debug: detect debug to include compressed files if debug is on
isRegistered (line 196)

Test if the key is registered.

  • return: True if the key is registered.
  • since: 11.1
  • access: public
boolean isRegistered (string $key)
  • string $key: The name of the key
link (line 243)

Write a <a></a> element

  • return: <a></a> string
  • since: 11.1
  • access: public
string link (string $url, string $text, [array $attribs = null])
  • string $url: The relative URL to use for the href attribute
  • string $text: The target attribute to use
  • array $attribs: An associative array of attributes to add
register (line 155)

Registers a function to be called with a specific key

  • return: True if the function is callable
  • since: 11.1
  • access: public
boolean register (string $key, string $function)
  • string $key: The name of the key
  • string $function: Function or method
script (line 566)

Write a <script></script> element

  • return: nothing if $path_only is false, null, path or array of path if specific js browser files were detected
  • see: JHtml::stylesheet
  • since: 11.1
  • access: public
mixed script (string $file, [boolean $framework = false], [boolean $relative = false], [boolean $path_only = false], [boolean $detect_browser = true], [boolean $detect_debug = true])
  • string $file: path to file
  • boolean $framework: load the JS framework
  • boolean $relative: path to file is relative to /media folder
  • boolean $path_only: return the path to the file only
  • boolean $detect_browser: detect browser to include specific browser js files
  • boolean $detect_debug: detect debug to search for compressed files if debug is on
setFormatOptions (line 615)

Set format related options.

Updates the formatOptions array with all valid values in the passed array. See {@see JHtml::$formatOptions} for details.

  • since: 11.1
  • access: public
void setFormatOptions (array $options)
  • array $options: Option key/value pairs.
stylesheet (line 520)

Write a <link rel="stylesheet" style="text/css" /> element

  • return: nothing if $path_only is false, null, path or array of path if specific css browser files were detected
  • see: JBrowser
  • since: 11.1
  • access: public
mixed stylesheet (string $file, [array $attribs = array()], [boolean $relative = false], [boolean $path_only = false], [boolean $detect_browser = true], [boolean $detect_debug = true])
  • string $file: path to file
  • array $attribs: attributes to be added to the stylesheet
  • boolean $relative: path to file is relative to /media folder
  • boolean $path_only: return the path to the file only
  • boolean $detect_browser:

    detect browser to include specific browser css files will try to include file, file_*browser*, file_*browser*_*major*, file_*browser*_*major*_*minor* <table> <tr><th>Navigator</th> <th>browser</th> <th>major.minor</th></tr>

    <tr><td>Safari 3.0.x</td> <td>konqueror</td> <td>522.x</td></tr> <tr><td>Safari 3.1.x and 3.2.x</td> <td>konqueror</td> <td>525.x</td></tr> <tr><td>Safari 4.0 to 4.0.2</td> <td>konqueror</td> <td>530.x</td></tr> <tr><td>Safari 4.0.3 to 4.0.4</td> <td>konqueror</td> <td>531.x</td></tr> <tr><td>iOS 4.0 Safari</td> <td>konqueror</td> <td>532.x</td></tr> <tr><td>Safari 5.0</td> <td>konqueror</td> <td>533.x</td></tr>

    <tr><td>Google Chrome 1.0</td> <td>konqueror</td> <td>528.x</td></tr> <tr><td>Google Chrome 2.0</td> <td>konqueror</td> <td>530.x</td></tr> <tr><td>Google Chrome 3.0 and 4.x</td> <td>konqueror</td> <td>532.x</td></tr> <tr><td>Google Chrome 5.0</td> <td>konqueror</td> <td>533.x</td></tr>

    <tr><td>Internet Explorer 5.5</td> <td>msie</td> <td>5.5</td></tr> <tr><td>Internet Explorer 6.x</td> <td>msie</td> <td>6.x</td></tr> <tr><td>Internet Explorer 7.x</td> <td>msie</td> <td>7.x</td></tr> <tr><td>Internet Explorer 8.x</td> <td>msie</td> <td>8.x</td></tr>

    <tr><td>Firefox</td> <td>mozilla</td> <td>5.0</td></tr> </table> a lot of others

  • boolean $detect_debug: detect debug to search for compressed files if debug is on
tooltip (line 716)

Creates a tooltip with an image as button

  • since: 11.1
  • access: public
string tooltip (string $tooltip, [mixed $title = ''], [string $image = 'tooltip.png'], [string $text = ''], [string $href = ''], [string $alt = 'Tooltip'], [string $class = 'hasTip'])
  • string $tooltip: The tip string
  • mixed $title: The title of the tooltip or an associative array with keys contained in {'title','image','text','href','alt'} and values corresponding to parameters of the same name.
  • string $image: The image for the tip, if no text is provided
  • string $text: The text for the tip
  • string $href: An URL that will be used to create the link
  • string $alt: The alt attribute for img tag
  • string $class: CSS class for the tool tip
unregister (line 175)

Removes a key for a method from registry.

  • return: True if a set key is unset
  • since: 11.1
  • access: public
boolean unregister (string $key)
  • string $key: The name of the key
_ (line 96)

Class loader method

Additional arguments may be supplied and are passed to the sub-class. Additional include paths are also able to be specified for third-party use

  • return: JHtml::call($function, $args) or False on error
  • throws: InvalidArgumentException
  • since: 11.1
  • access: public
mixed _ (string $key)
  • string $key: The name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.
/html>