API15:JRegistry/loadArray
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
Load a associative array of values into the default namespace
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
loadArray($array, $namespace=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $array | $array Associative array of value to load | |
| $namespace | null | $namepsace The name of the namespace |
Returns
boolean True on success
Defined in
libraries/joomla/registry/registry.php
Importing
jimport( 'joomla.registry.registry' );
Source Body
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; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
