![]() |
| > Home > Documentation > Latest documentation > Interchange tags > tree |
|
treeProvides an iterative list capability for parent/child hierarchies. Summary
ExamplesTag expansion exampleThe [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:
Perl example
or similarly with positional parameters:
DescriptionThis 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. Hash keysSets several keys which assist in walking and displaying the tree, to be used within the looping tags construct, such as [PREFIX-param]. See the Looping tags introduction. mv_levelLevel of the item. 0 is the first level. Sub-levels are infinite (except for performance). mv_incrementIncrement label for the item. This normally goes from 1...n, but can be changed to A...Z or a...z, in outline mode. mv_childrenIf in autodetect mode then this is set to the number of children in this branch. If a leaf then it is set to 0. mv_spacingThis is a multiple of the value of the spacing parameter, and is useful for determining the row indentation width. ParameterstableDatabase table which contains the tree. Must be a valid Interchange table name. masterThe column which is used to determine the parent of the item. subordinateThe 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. startautodetectSpecifies 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. code_fieldcollapseThe 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. Collapse/explode/toggle status values will only be retained if the memo parameter is set true. continueThe name of an optional continue field which, when set true, can force the branch to be followed. delimiterexplodeThe 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. Collapse/explode/toggle status values will only be retained if the memo parameter is set true. filefullSpecifies 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. toggleThe 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. collapse/explode/toggle status values will only be retained if the memo parameter is set true. 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. level_fieldlog_errorWhen 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. memoThis parameter names a scratchpad variable where the persistent status values for the the collapse/explode/toggle feature should be stored. multiple_startobjectoutlineSets 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:
pedanticWhen 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. show_errorWhen 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. sortThe column which should be used for ordering the items. This determines the order in which they will be displayed under the current parent. spacerspacingstart_itemThe first item to be followed, i.e. the master value of all the top-level items. stopAn optional stop field which which, when the value is true, can stop the following of the current branch. where
|
| Home | Legal nonsense | Privacy policy | Contact us |