fm:Array


This component allows you to set an array of items, and to access any of them individually, or list all of them in a loop.

Example 1: Array elements shown individually

To show array elements individually, they must be referenced explicitly, meaning their array key must b ereferenced.

<fm:Array key="list" delimiter="," value="orange,apple,pear"> {$array_list.0} <br/> {$array_list.2} <br/> {$array_list.1} <br/> </fm:Array>

Result for Example 1:

orange
pear
apple

Example 2: Array elements shown in a loop

To show array elements individually, they must be referenced explicitly, meaning their array key must b ereferenced.

<fm:Array key="list" delimiter="," value="orange,apple,pear,banana"> <fm:Loop> array_element - {$$array_element} <br /> </fm:Loop> </fm:Array>

Result for Example 2:

array_element - orange
array_element - apple
array_element - pear
array_element - banana

Supported Attributes

NameRequiredDefaultDescription
delimiterRequiredN/AThe value separator used in value. Eg. ,
jsonRequiredN/AIf set to 1, then delimiter isn't required and the input is assumed to be json
keyRequiredN/AThe name of the array
valueRequiredN/AThe values you want to assign to the array, delimited.

Template variables

NameDescription
loop.hasResultsThe contents of this variable will be either 0 or 1, depending on if there are items in the list.
loop.oddClassThe contents of this variable will reflect the "oddClass" attribute. This will only be set for odd rownumbers.
loop.evenClassThe contents of this variable will reflect the "evenClass" attribute. This will only be set for even rownumbers.
loop.indexThe 0-based index of the item in the loop. (Will contain 0,1,2,3,4, etc.)
loop.countThe count of the current item in the loop. (Will contain 1,2,3,4,5 etc.)
loop.currentPageIf a pager is involved in this loop, this will contain the current page number (0-based index). If page information is not available, this will be 0.
loop.currentPage1This value is currentPage + 1. This number can be useful to display the current page number to use user. (people generally count from 1, not 0).
loop.totalPagesTotal number of pages avaiable in this loop. This will be 0 if the loop does not support paging.
loop.totalItemsTotal number of individual items. This will be 0 if the loop does not support paging.
loop.pageSizeTotal number of items on 1 single page. This will be 0 if the loop does not support paging.
array_{key}An array you provided key="foo" the variable would be $array_foo.1, $array_foo.2