Home: Support: Reference Guide: Miscellaneous Tags: <dpArray>
<dpArray>
D E F I N I T I O N:
<dpArray> allows you to sort and display values you set in an array using <dpArrayElement>. It is most commonly used to display unique and sorted lists of authors in your database.
<dpArray
name="arrayName"
sort="ascending|descending|asc|desc"
number="all|#"
return="value|count"
>
A T T R I B U T E S:
- name="arrayName"
- The name attribute is used for the name of the array you are referencing. It should
be the same name you used when defining your array with <dpArrayElement></dpArrayElement>
- sort="ascending|descending|asc|desc"
- The sort attribute lets you sort the array either ascending or descending. Asc and Desc
are aliases to ascending and descending. The default sort is ascending.
- number="all|#"
- By default <dpArray> will return "all" elements in the array. You may also optionally
choose to loop through an array or request a specific element by using the number attribute.
- return="value|count"
- By default <dpArray> will return all the elements in the array. You may
also optionally choose to get just a count of elements in the array. This is most
commonly used in conjunction of looping through an array or checking the size
of an array before displaying it.
E X A M P L E S:
<dpArray name="myList" sort="ascending">
myList has <dpArray name="myList" return="count"> values.
<dpLoop var="i" from="1" to="<dpArray name="myList" return="count">">
<dpArray name="myList" number="<dpVar i>" sort="ascending">
</dpLoop>
D E T A I L S:
- <dpArray> can be used as a stand alone tag which will perform the
requested sort and display the entire array (each element). It can also be
used interactively in conjunction with <dpLoop> to traverse through the array.
- name is required. All other values are optional and have default settings.
- The name is the same name you used to set each array element.
- sorting can be ascending or descending, with ascending as the default.
- by default, <dpArray> will return the whole array, but you may request
an individual element number as well, by using number="#"
- return="count" will return the number of elements the array holds.