JHtml
Utility class for all HTML drawing classes
package |
Joomla.Platform |
---|---|
subpackage |
HTML |
since |
11.1 |
Methods
_
Class loader method
_(string $key) : mixed
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
string
The name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.
Response
mixed
JHtml::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
see | \JBrowser |
---|---|
since |
11.1 |
deprecated |
12.1 |
Arguments
- $file
string
path to file- $relative
boolean
path to file is relative to /media folder- $detect_browser
boolean
detect browser to include specific browser files- $folder
string
folder name to search into (images, css, js, ...)
Response
array
files 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
since |
11.1 |
---|
Arguments
- $path
string
A path to search.
Response
array
An 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
since |
11.1 |
---|
Arguments
- $value
string
The date value- $name
string
The name of the text field- $id
string
The id of the text field- $format
string
The date format- $attribs
array
Additional HTML attributes
Response
string
HTML markup for a calendar field
call
Function caller method
call(string $function, array $args) : mixed
see | |
---|---|
since |
11.1 |
Arguments
- $function
string
Function or method to call- $args
array
Arguments to be passed to function
Response
mixed
Function result or false on error.
core
Add the /media/system/js/core Javascript file.
core(boolean $debug = null) : void
since |
11.1 |
---|---|
deprecated |
12.1 Use JHtml::_('behavior.framework'); instead. |
Arguments
- $debug
boolean
True 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
see | \strftime |
---|---|
since |
11.1 |
Arguments
- $input
string
String in a format accepted by date(), defaults to "now".- $format
string
Format optional format for strftime- $tz
mixed
Time zone to be used for the date. Special cases: boolean true for user setting, boolean false for server setting.- $gregorian
boolean
True to use Gregorian calenar
Response
string
A date translated by the given format and time zone.
extract
Method to extract a key
extract(string $key) : array
since |
11.1 |
---|
Arguments
- $key
string
The name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers.
Response
array
Contains lowercase key, prefix, file, function.
iframe
Write a element
iframe(string $url, string $name, array $attribs = null, string $noFrames = '') : string
since |
11.1 |
---|
Arguments
- $url
string
The relative URL to use for the src attribute- $name
string
The target attribute to use- $attribs
array
An associative array of attributes to add- $noFrames
string
The 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
since |
11.1 |
---|
Arguments
- $file
string
The relative or absolute URL to use for the src attribute- $alt
string
The alt text.- $attribs
string
The target attribute to use- $relative
array
An associative array of attributes to add- $path_only
boolean
If 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
see | \JBrowser |
---|---|
since |
11.1 |
Arguments
- $folder
string
folder name to search into (images, css, js, ...)- $file
string
path to file- $relative
boolean
path to file is relative to /media folder- $detect_browser
boolean
detect browser to include specific browser files- $detect_debug
boolean
detect debug to include compressed files if debug is on
Response
array
files to be included
isRegistered
Test if the key is registered.
isRegistered(string $key) : boolean
since |
11.1 |
---|
Arguments
- $key
string
The name of the key
Response
boolean
True if the key is registered.
link
link(string $url, string $text, array $attribs = null) : string
register
Registers a function to be called with a specific key
register(string $key, string $function) : boolean
since |
11.1 |
---|
Arguments
- $key
string
The name of the key- $function
string
Function or method
Response
boolean
True 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
see | \JHtml::stylesheet |
---|---|
since |
11.1 |
Arguments
- $file
string
path to file- $framework
boolean
load the JS framework- $relative
boolean
path to file is relative to /media folder- $path_only
boolean
return the path to the file only- $detect_browser
boolean
detect browser to include specific browser js files- $detect_debug
boolean
detect debug to search for compressed files if debug is on
Response
mixed
nothing 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
Updates the formatOptions array with all valid values in the passed array. See \JHtml::$formatOptions for details.
since |
11.1 |
---|
Arguments
- $options
array
Option 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
see | \JBrowser |
---|---|
since |
11.1 |
Arguments
- $file
string
path to file- $attribs
array
attributes to be added to the stylesheet- $relative
boolean
path to file is relative to /media folder- $path_only
boolean
return the path to the file only- $detect_browser
boolean
detect browser to include specific browser css files will try to include file, filebrowser, filebrowsermajor, filebrowsermajorminorNavigator 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
boolean
detect debug to search for compressed files if debug is on
Response
mixed
nothing 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
since |
11.1 |
---|
Arguments
- $tooltip
string
The tip string- $title
mixed
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.- $image
string
The image for the tip, if no text is provided- $text
string
The text for the tip- $href
string
An URL that will be used to create the link- $alt
string
The alt attribute for img tag- $class
string
CSS class for the tool tip
Response
string
unregister
Removes a key for a method from registry.
unregister(string $key) : boolean
since |
11.1 |
---|
Arguments
- $key
string
The name of the key
Response
boolean
True 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.
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
since |
11.1 |
---|
Type(s)
array
registry
An array to hold method references
since |
11.1 |
---|
Type(s)
array