It takes an array of elements and creates an array of arrays, with each element occuping one cell. It's used to format a series of elements (numbers, strings, pairs, arrays, etc) into multiple columns/rows.
It will create an even number of columns for each row, filling in the emtpy cell(s) with null. Rather than testing for null when displaying values, you can instead specify the value of the empty cells by using -empty=(somevalue). So if your cells consisted of an array of values, such as: (array:'name','id','phone')
then you'd want the empty value to look like: -empty=(array: ' ',0,' ').
Parameters
-array_of_items
array, required
An array of elements to format.
-maxcols
integer, optional
Maximum number of columns.
-maxrows
integer, optional
Maximum number of rows.
-empty
string, optional
Value to use for empty cells, default is null.
-fill
boolean, optional
Fill to -maxcols/-maxrows? Default is to trim cells to dataset size.
-vertical
boolean, optional
Fill the elements in vertically, default is horizontal.
Sample Usage
[var:'array' = (array:'a','b','c','d','e','f','g','h','i')]
<pre>
<b>-=['['] E X A M P L E S [']']=-</b>
<b>Raw:</b>
[iterate: $array, var:'cell'][$cell] [/iterate]
<b>Horizontal:</b>
[iterate: (lp_array_columns: $array), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Vertical:</b>
[iterate: (lp_array_columns: $array, -vert), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Horizontal -maxcols=2:</b>
[iterate: (lp_array_columns: $array, -maxcols=2), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Horizontal -maxrows=2:</b>
[iterate: (lp_array_columns: $array, -maxrows=2), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Horizontal -maxcols=2, -maxrows=2:</b>
[iterate: (lp_array_columns: $array, -maxcols=2, -maxrows=2), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Vertical -maxcols=2:</b>
[iterate: (lp_array_columns: $array, -vert, -maxcols=2), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Vertical -maxrows=2:</b>
[iterate: (lp_array_columns: $array, -vert, -maxrows=2), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
<b>Vertical -maxcols=2, -maxrows=2:</b>
[iterate: (lp_array_columns: $array, -vert, -maxcols=2, -maxrows=2), var:'row']
[iterate: $row, var:'cell'][$cell] [/iterate][/iterate]
</pre>
Returns:
-=[ E X A M P L E S ]=-
Raw:
a b c d e f g h i
Horizontal:
a b c
d e f
g h i
Vertical:
a d g
b e h
c f i
Horizontal -maxcols=2:
a b
c d
e f
g h
i
Horizontal -maxrows=2:
a b c d e
f g h i
Horizontal -maxcols=2, -maxrows=2:
a b
c d
Vertical -maxcols=2:
a f
b g
c h
d i
e
Vertical -maxrows=2:
a c e g i
b d f h
Vertical -maxcols=2, -maxrows=2:
a c
b d
Source Code
Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.