Actions

API16

JNode/setParent

From Joomla! Documentation

< API16:JNode
Revision as of 17:37, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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
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 />