API16

JHtml/register

< API16:JHtml

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

Registers a function to be called with a specific key


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

Syntax

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

Defined in

libraries/joomla/html/html.php

Importing

jimport( 'joomla.html.html' );

Source Body

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

Code Examples


Advertisement