Logic Tags
Tag appendhierdata


This tag is used to create hierarchical data by appending child data or adding new child data if none exist. Use this tag to append data from the data attribute to the target location specified by the index attribute. If no children exists, the data is added as children. An index attribute with no value creates a new hierarchical data structure.The example below appends the data named "communityPages" to "topCommunities" at index 0,2. If "topCommunities" contains a list of Communities and their Subcommunities and communityPages contains a list of Community Pages this tag adds Community Pages in "communityPages"to the 3rd Subcommunity (2 is the 3rd element in 0 based index) of the first top level Community. In the example, the pt:childkey attribute specifies that you are adding data to Community Pages; this attribute is not needed when appending a list of subcommunities as it is the default child type for communities.

Example:
<pt:logic.appendhierdata pt:id="topCommunities" pt:dataid="communityPages" pt:index="0,2" pt:childkey="commpages" />
// append a community to second top level community
<pt:logic.appendhierdata pt:id="topCommunities" pt:dataid="newcomm" pt:index="1" />


Tag Information
Tag Nameappendhierdata

Attributes
NameTypeRequiredDefault ValueDescription
datastringtruenullName of tag variable with data to append to target hierarchical structure.
datascopestringfalseportlet requestScope of the data tag variable name.
targetstringtruenullName of the target tag variable.
scopestringfalseportlet requestScope of the target tag variable.
indexstringtruenullComma separated list of numbers specifying the position in the hierarchical data structure at which to replace the data. The first number specifies index in the top list, and each following number index in lower level lists. 0 represents the first element of a list. A value of '2,0,12' inserts data into 3rd entry in the top list, first entry in the second list and 13th entry in the 3rd level list.
Examples:
"0" - Insert data list as children to the first top level entry
"1,3" - Inserth children as the 4th child object of the 2nd top level data object
childkeystringfalsechildrenHierarchical data key if different from the default 'children'. For example, used when adding Community Pages children to Communities.


Copyright 2005 Plumtree Software, Inc.