JNode: Difference between revisions
From Joomla! Documentation
New page: <span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{Description:JNode}}
===Defined in===
libraries... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
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=== | ===Defined in=== | ||
| Line 33: | Line 30: | ||
<source lang="php">jimport( 'joomla.base.tree' );</source> | <source lang="php">jimport( 'joomla.base.tree' );</source> | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=JNode | category=JNode | ||
namespace=CodeExample | |||
category=ClassExample | category=ClassExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
Latest revision as of 00:59, 25 March 2017
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/tree.php
Methods
| Method name | Description |
|---|---|
| __construct | Class constructor, overridden in descendant classes. |
| addChild | |
| getParent | |
| setParent | |
| hasChildren | |
| getChildren |
Importing
jimport( 'joomla.base.tree' );
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.