Actions

API16

Difference between revisions of "JNode/setParent"

From Joomla! Documentation

< API16:JNode
(New page: ===Description=== Set the parent of a this node <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> ...)
 
 
Line 17: Line 17:
 
!Description
 
!Description
 
|-
 
|-
|  
+
| &$parent
 
|  
 
|  
 
|  the parent to be setted  
 
|  the parent to be setted  

Latest revision as of 05:00, 30 March 2010

Replacement filing cabinet.png
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

Set the parent of a this node

[Edit Descripton]

Description:JNode/setParent

Syntax

setParent(&$parent)
Parameter Name Default Value Description
&$parent the parent to be setted

Defined in

libraries/joomla/base/node.php

Importing

jimport( 'joomla.base.node' );

Source Body

function setParent(&$parent) 
{
        if ($parent instanceof JNode || is_null($parent)) 
        {
                $hash = spl_object_hash($this);
                if (!is_null($this->_parent)) 
                {
                        unset($this->_parent->children[$hash]);
                }
                if (!is_null($parent)) 
                {
                        $parent->_children[$hash] = & $this;
                }
                $this->_parent = & $parent;
        }
}

[Edit See Also] SeeAlso:JNode/setParent

Examples

<CodeExamplesForm />