API16

JRegistry/loadArray

From Joomla! Documentation

< API16:JRegistry
Revision as of 17:55, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Load a associative array of values into the default namespace <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JRegistry/loadArray|E...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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]

Load a associative array of values into the default namespace

[Edit Descripton]

Template:Description:JRegistry/loadArray

Syntax[edit]

loadArray($array, $namespace=null)
Parameter Name Default Value Description
$array Associative array of value to load
$namespace null The name of the namespace

Returns[edit]

boolean True on success

Defined in[edit]

libraries/joomla/registry/registry.php

Importing[edit]

jimport( 'joomla.registry.registry' );

Source Body[edit]

public function loadArray($array, $namespace = null)
{
        // If namespace is not set, get the default namespace
        if ($namespace == null) {
                $namespace = $this->_defaultNameSpace;
        }

        if (!isset($this->_registry[$namespace])) {
                // If namespace does not exist, make it and load the data
                $this->makeNameSpace($namespace);
        }

        // Load the variables into the registry's default namespace.
        foreach ($array as $k => $v) {
                $this->_registry[$namespace]['data']->$k = $v;
        }

        return true;
}

[Edit See Also] Template:SeeAlso:JRegistry/loadArray

Examples[edit]

<CodeExamplesForm />