API16:JHtml/
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Class loader method
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
static _($type)
| Parameter Name | Default Value | Description |
|---|---|---|
| $type | The name of helper method to load, (prefix).(class).function prefix and class are optional and can be used to load custom html helpers. |
Defined in
libraries/joomla/html/html.php
Importing
jimport( 'joomla.html.html' );
Source Body
public static function _($type) { $type = preg_replace('#[^A-Z0-9_\.]#i', '', $type); // Check to see if we need to load a helper file $parts = explode('.', $type); $prefix = (count($parts) == 3 ? array_shift($parts) : 'JHtml'); $file = (count($parts) == 2 ? array_shift($parts) : ''); $func = array_shift($parts); $key = strtolower($prefix.'.'.$file.'.'.$func); if (array_key_exists($key, self::$registry)) { $function = self::$registry[$key]; $args = func_get_args(); // remove function name from arguments array_shift($args); return JHtml::call($function, $args); } $className = $prefix.ucfirst($file); if (!class_exists($className)) { jimport('joomla.filesystem.path'); if ($path = JPath::find(JHtml::$includePaths, strtolower($file).'.php')) { require_once $path; if (!class_exists($className)) { JError::raiseError(500, $className.'::' .$func. ' not found in file.'); return false; } } else { JError::raiseError(500, $prefix.$file . ' not supported. File not found.'); return false; } } $toCall = array($className, $func); if (is_callable($toCall)) { JHtml::register($key, $toCall); $args = func_get_args(); // remove function name from arguments array_shift($args); return JHtml::call($toCall, $args); } else { JError::raiseError(500, $className.'::'.$func.' not supported.'); return false; } }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
