Difference between revisions of "JRegistry/getValue"
From Joomla! Documentation
< API15:JRegistry
(New page: ===Description===
Get a registry value
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 72: | Line 72: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 87: | Line 87: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 13:43, 12 May 2013
The "API15" 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]
Get a registry value
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
getValue($regpath, $default=null)
Parameter Name | Default Value | Description |
---|---|---|
$regpath | $regpath Registry path (e.g. joomla.content.showauthor) | |
$default | null | $default Optional default value |
Returns[edit]
mixed Value of entry or null
Defined in[edit]
libraries/joomla/registry/registry.php
Importing[edit]
jimport( 'joomla.registry.registry' );
Source Body[edit]
function getValue($regpath, $default=null)
{
$result = $default;
// Explode the registry path into an array
if ($nodes = explode('.', $regpath))
{
// Get the namespace
//$namespace = array_shift($nodes);
$count = count($nodes);
if ($count < 2) {
$namespace = $this->_defaultNameSpace;
$nodes[1] = $nodes[0];
} else {
$namespace = $nodes[0];
}
if (isset($this->_registry[$namespace])) {
$ns = & $this->_registry[$namespace]['data'];
$pathNodes = $count - 1;
//for ($i = 0; $i < $pathNodes; $i ++) {
for ($i = 1; $i < $pathNodes; $i ++) {
if((isset($ns->$nodes[$i]))) $ns =& $ns->$nodes[$i];
}
if(isset($ns->$nodes[$i])) {
$result = $ns->$nodes[$i];
}
}
}
return $result;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />