JHtml

Utility class for all HTML drawing classes

abstract
package

Joomla.Platform

subpackage

HTML

since

11.1

Methods

_

Class loader method

_(string $key) : mixed
static

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

since

11.1

Arguments

$key

stringThe name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.

Response

mixedJHtml::call($function, $args) or False on error

_includeRelativeFiles

Compute the files to be include

_includeRelativeFiles(string $file, boolean $relative, boolean $detect_browser, string $folder) : array
static deprecated
see \JBrowser
since

11.1

deprecated

12.1

Arguments

$file

stringpath to file

$relative

booleanpath to file is relative to /media folder

$detect_browser

booleandetect browser to include specific browser files

$folder

stringfolder name to search into (images, css, js, ...)

Response

arrayfiles to be included

addIncludePath

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

addIncludePath(string $path = '') : array
static
since

11.1

Arguments

$path

stringA path to search.

Response

arrayAn array with directory elements

calendar

Displays a calendar control field

calendar(string $value, string $name, string $id, string $format = '%Y-%m-%d', array $attribs = null) : string
static
since

11.1

Arguments

$value

stringThe date value

$name

stringThe name of the text field

$id

stringThe id of the text field

$format

stringThe date format

$attribs

arrayAdditional HTML attributes

Response

stringHTML markup for a calendar field

call

Function caller method

call(string $function, array $args) : mixed
static
see

http://php.net/manual/en/function.call-user-func-array.php

since

11.1

Arguments

$function

stringFunction or method to call

$args

arrayArguments to be passed to function

Response

mixedFunction result or false on error.

core

Add the /media/system/js/core Javascript file.

core(boolean $debug = null) : void
static deprecated
since

11.1

deprecated

12.1 Use JHtml::_('behavior.framework'); instead.

Arguments

$debug

booleanTrue if debugging is enabled.

date

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

date(string $input = 'now', string $format = null, mixed $tz = true, boolean $gregorian = false) : string
static
see \strftime
since

11.1

Arguments

$input

stringString in a format accepted by date(), defaults to "now".

$format

stringFormat optional format for strftime

$tz

mixedTime zone to be used for the date. Special cases: boolean true for user setting, boolean false for server setting.

$gregorian

booleanTrue to use Gregorian calenar

Response

stringA date translated by the given format and time zone.

extract

Method to extract a key

extract(string $key) : array
static
since

11.1

Arguments

$key

stringThe name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.

Response

arrayContains lowercase key, prefix, file, function.

iframe

Write a element

iframe(string $url, string $name, array $attribs = null, string $noFrames = '') : string
static
since

11.1

Arguments

$url

stringThe relative URL to use for the src attribute

$name

stringThe target attribute to use

$attribs

arrayAn associative array of attributes to add

$noFrames

stringThe message to display if the iframe tag is not supported

Response

string element or message if not supported

image

Write a element

image(string $file, string $alt, string $attribs = null, array $relative = false, boolean $path_only = false) : string
static
since

11.1

Arguments

$file

stringThe relative or absolute URL to use for the src attribute

$alt

stringThe alt text.

$attribs

stringThe target attribute to use

$relative

arrayAn associative array of attributes to add

$path_only

booleanIf set to true, it tries to find an override for the file in the template

Response

string

includeRelativeFiles

Compute the files to be include

includeRelativeFiles(string $folder, string $file, boolean $relative, boolean $detect_browser, boolean $detect_debug) : array
static
see \JBrowser
since

11.1

Arguments

$folder

stringfolder name to search into (images, css, js, ...)

$file

stringpath to file

$relative

booleanpath to file is relative to /media folder

$detect_browser

booleandetect browser to include specific browser files

$detect_debug

booleandetect debug to include compressed files if debug is on

Response

arrayfiles to be included

isRegistered

Test if the key is registered.

isRegistered(string $key) : boolean
static
since

11.1

Arguments

$key

stringThe name of the key

Response

booleanTrue if the key is registered.

register

Registers a function to be called with a specific key

register(string $key, string $function) : boolean
static
since

11.1

Arguments

$key

stringThe name of the key

$function

stringFunction or method

Response

booleanTrue if the function is callable

script

Write a element

script(string $file, boolean $framework = false, boolean $relative = false, boolean $path_only = false, boolean $detect_browser = true, boolean $detect_debug = true) : mixed
static
see \JHtml::stylesheet
since

11.1

Arguments

$file

stringpath to file

$framework

booleanload the JS framework

$relative

booleanpath to file is relative to /media folder

$path_only

booleanreturn the path to the file only

$detect_browser

booleandetect browser to include specific browser js files

$detect_debug

booleandetect debug to search for compressed files if debug is on

Response

mixednothing if $path_only is false, null, path or array of path if specific js browser files were detected

setFormatOptions

Set format related options.

setFormatOptions(array $options) : void
static

Updates the formatOptions array with all valid values in the passed array. See \JHtml::$formatOptions for details.

since

11.1

Arguments

$options

arrayOption key/value pairs.

stylesheet

Write a element

stylesheet(string $file, array $attribs = array(), boolean $relative = false, boolean $path_only = false, boolean $detect_browser = true, boolean $detect_debug = true) : mixed
static
see \JBrowser
since

11.1

Arguments

$file

stringpath to file

$attribs

arrayattributes to be added to the stylesheet

$relative

booleanpath to file is relative to /media folder

$path_only

booleanreturn the path to the file only

$detect_browser

booleandetect browser to include specific browser css files will try to include file, filebrowser, filebrowsermajor, filebrowsermajorminor

Navigator browser major.minor
Safari 3.0.x konqueror 522.x
Safari 3.1.x and 3.2.x konqueror 525.x
Safari 4.0 to 4.0.2 konqueror 530.x
Safari 4.0.3 to 4.0.4 konqueror 531.x
iOS 4.0 Safari konqueror 532.x
Safari 5.0 konqueror 533.x
Google Chrome 1.0 konqueror 528.x
Google Chrome 2.0 konqueror 530.x
Google Chrome 3.0 and 4.x konqueror 532.x
Google Chrome 5.0 konqueror 533.x
Internet Explorer 5.5 msie 5.5
Internet Explorer 6.x msie 6.x
Internet Explorer 7.x msie 7.x
Internet Explorer 8.x msie 8.x
Firefox mozilla 5.0
                               a lot of others
$detect_debug

booleandetect debug to search for compressed files if debug is on

Response

mixednothing if $path_only is false, null, path or array of path if specific css browser files were detected

tooltip

Creates a tooltip with an image as button

tooltip(string $tooltip, mixed $title = '', string $image = 'tooltip.png', string $text = '', string $href = '', string $alt = 'Tooltip', string $class = 'hasTip') : string
static
since

11.1

Arguments

$tooltip

stringThe tip string

$title

mixedThe 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.

$image

stringThe image for the tip, if no text is provided

$text

stringThe text for the tip

$href

stringAn URL that will be used to create the link

$alt

stringThe alt attribute for img tag

$class

stringCSS class for the tool tip

Response

string

unregister

Removes a key for a method from registry.

unregister(string $key) : boolean
static
since

11.1

Arguments

$key

stringThe name of the key

Response

booleanTrue if a set key is unset

Properties

formatOptions

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

static

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

since

11.1

Type(s)

array

includePaths

An array to hold included paths

static
since

11.1

Type(s)

array

registry

An array to hold method references

static
since

11.1

Type(s)

array