|> Home > Documentation > Latest documentation > Interchange tags > tree|
Provides an iterative list capability for parent/child hierarchies.
Tag expansion example
The [tree] tag works with data sets with the following parent/child structure:
The above sample data, placed in a table named "tree", could be used to as follows:
or similarly with positional parameters:
This tag provides an iterative list capability for binary trees It presents the tree data in a loop of hash-based rows, pretty much the same as as [item-list].
Some additional hash key entries are also provided, to describe the tree and provide display control.
Level of the item. 0 is the first level. Sub-levels are infinite (except for performance).
Increment label for the item. This normally goes from 1...n, but can be changed to A...Z or a...z, in outline mode.
If in autodetect mode then this is set to the number of children in this branch. If a leaf then it is set to 0.
This is a multiple of the value of the spacing parameter, and is useful for determining the row indentation width.
Database table which contains the tree. Must be a valid Interchange table name.
The column which is used to determine the parent of the item.
The child column, which determines which items are sub-items of the current item. This is used to re-query for items with its value in master.
Specifies that the next level should be followed to detect the number of child items contained. This is not recursive; It only follows far enough to determine the children of the current item.
The name of a variable, in the user's session, which will determine whether the tree should be "collapsed". When collapsed, the child items will not be followed unless they are set to be followed with toggle. This parameter zeros all toggles.
The name of an optional continue field which, when set true, can force the branch to be followed.
The name of a variable, in the user's session, which will determine whether the tree should be "exploded". When exploded, all child items are followed and the full tree can be displayed.
Specifies that all items should be followed. This is essentially the same as specifying memo and passing the explode variable, but is not dependent upon them. Useful for building lists for inclusion in embedded Perl, among other things.
The name of a variable, in the user's session, which will determine whether the current item should be followed or not. The first time the toggle variable corresponding to its primary key is passed, the item will be "exploded". The next call will "collapse" the item.
In addition to the above values, all valid options for a list tag are in force. For example, you can set a "selected" value on an option list with option=1, and the tag prefix with prefix etc.
When set to a true value, and an endless tree is detected (i.e. the child branch contains a parent), the error will be logged to the website's "error.log" file. No logging is performed by default.
Sets outline mode, where mv_increment will be displayed with letter or numerical values. If set to specifically "1", it will produce outline increments like the following:
When set to a true value, and an endless tree is detected (i.e. the child branch contains a parent), the error will be logged to the website's "error.log" file, and the [tree] tag call will return with an error.
If pedantic is false (the default), the current leaf will be shown but never followed. This allows a partial display of the tree to be rendered.
When set to a true value, and an endless tree is detected (i.e. the child branch contains a parent), the error will be returned in the page. Errors are NOT shown by default.
The column which should be used for ordering the items. This determines the order in which they will be displayed under the current parent.
The first item to be followed, i.e. the master value of all the top-level items.
An optional stop field which which, when the value is true, can stop the following of the current branch.