JTree: Difference between revisions
From Joomla! Documentation
New page: <span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{Description:JTree}}
===Defined in===
libraries... |
m clean up |
||
| Line 1: | Line 1: | ||
JTree is a class that allows you to create and walk through object-trees. Used in conjunction with the JNode class. | |||
===Defined in=== | ===Defined in=== | ||
| Line 27: | Line 24: | ||
<source lang="php">jimport( 'joomla.base.tree' );</source> | <source lang="php">jimport( 'joomla.base.tree' );</source> | ||
{{subst:SeeAlso:JTree}} | |||
{{SeeAlso:JTree}} | |||
===Examples=== | ===Examples=== | ||
Revision as of 13:26, 24 March 2017
JTree is a class that allows you to create and walk through object-trees. Used in conjunction with the JNode class.
Defined in
libraries/joomla/base/tree.php
Methods
| Method name | Description |
|---|---|
| __construct | Class constructor, overridden in descendant classes. |
| addChild | |
| getParent | |
| reset |
Importing
jimport( 'joomla.base.tree' );
{{subst:SeeAlso:JTree}}
Examples
<CodeExamplesForm />
JTree and JNode can be used to create and process simple tree structures. Let's see how this works for JTree with a simple example.
We want to create the Family Tree 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.