API15:JNode

From Joomla! Documentation

Jump to: navigation, search

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Contents

Defined in

libraries/joomla/base/tree.php

Methods

Method name Description
__construct Class constructor, overridden in descendant classes.
addChild
getParent
setParent
hasChildren
getChildren

Importing

jimport( 'joomla.base.tree' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree.

$barbara = new JNode();
$stefanie = new JNode();
$sue = new JNode();
$peter = new JNode();
$stewie = new JNode();
 
//Granny Barbara has two children, stefanie, and sue
$barbara->addChild($stefanie);
$barbara->addChild($sue);
 
/*
 * Sometimes we want declare parent-child relationships the other way around.
 * We can also do that
 */
 
$peter->setParent($stefanie);
$stewie->setParent($stefanie);
Batch1211 19:48, 22 March 2010 (EDT) Edit comment

[Edit Descripton] JNode is a class that allows you to create nodes, normaly used as "leaves" of object-trees. Often used in conjunction with the JTree class.

Defined in

libraries/joomla/base/node.php

Methods

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

Importing

jimport( 'joomla.base.node' );

[Edit See Also] SeeAlso:JNode

Examples

{{Expansion depth limit exceeded}}

Tree Structures with JNode

JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JNode with a simple example.

We want represent the family structure of the Smiths. Granny Barbara has two daughters. Stefanie and Aunti Sue. Stefanie has two children, Peter and Stewie. Auntie Sue doesn't have children.

Let's take a look how we can represent this familiy in an object tree. Invalid tag extension name: <span class="error">expansion depth limit exceeded</span>

Batch1211 19:48, 22 March 2010 (EDT) Edit comment

Invalid tag extension name: <span class="error">expansion depth limit exceeded</span>Edit DescriptonInvalid tag extension name: <span class="error">expansion depth limit exceeded</span> {{Expansion depth limit exceeded}}

<span class="error">Expansion depth limit exceeded libraries/joomla/base/node.php <span class="error">Expansion depth limit exceeded

Method name Description
__construct Constructor
addChild Add child to this node
setParent Set the parent of a this node
getChildren Get the children of this node
getParent Get the parent of this node
hasChildren Test if this node has children
hasParent Test if this node has a parent

<span class="error">Expansion depth limit exceeded Invalid tag extension name: <span class="error">expansion depth limit exceeded</span>

Invalid tag extension name: <span class="error">expansion depth limit exceeded</span>Edit See AlsoInvalid tag extension name: <span class="error">expansion depth limit exceeded</span> {{Expansion depth limit exceeded}}

<span class="error">Expansion depth limit exceeded Invalid tag extension name: <span class="error">expansion depth limit exceeded</span> Invalid tag extension name: <span class="error">expansion depth limit exceeded</span>

Personal tools