API16

JHtml/register

From Joomla! Documentation

< API16:JHtml
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Registers a function to be called with a specific key


<! removed transcluded page call, red link never existed >

Syntax[edit]

static register($key, $function)
Parameter Name Default Value Description
$key The name of the key
$function Function or method

Defined in[edit]

libraries/joomla/html/html.php

Importing[edit]

jimport( 'joomla.html.html' );

Source Body[edit]

public static function register($key, $function)
{
        $parts = explode('.', $key);

        $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 (is_callable($function))
        {
                self::$registry[$key] = $function;
                return true;
        }

        return false;
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]