Using a 'Global Tag', or...
Using the [ArrayGet] context to retrieve several index values.
Here we will discuss using the [ArrayGet] context.
[arrayget name=myarray]
[loop start=1&end=2]
[loop start=1&end=2]
[loop start=1&end=2]
Index [::::index],[::index],[index] = ([::::index],[::index],[index])
[/loop]
[/loop]
[/loop]
[/arrayget]
[ArrayGet] takes just one parameter; 'name', in which you place an existing array variable name. The (a,b,c,d,e) patterns evaluate to the corresponding index values. These patterns can be intermingled with other text, as shown.
Index 1,1,1 = 1-1-1
Index 1,1,2 = 1-1-2
Index 1,2,1 = 1-2-1
Index 1,2,2 = 1-2-2
Index 2,1,1 = 2-1-1
Index 2,1,2 = 2-1-2
Index 2,2,1 = 2-2-1
Index 2,2,2 = 2-2-2
[NumDims] Tag
You can use the [NumDims] tag to retrieve the number of dimensions for an array.
For example:
[ArraySet name=array_1&dim=3,3,10][/ArraySet]
array_1 contains [ArrayGet name=array_1][numdims][/ArrayGet] dimensions.<br>
Results:
array_1 contains 3 dimensions.
You can also use the 'array name' global tag to retrieve the number of dimension
in a named array object. Here is the code:
[ArraySet name=array_1&dim=3,3,10][/ArraySet]
array_1 contains [array_1(numdims)] dimensions.
Results:
array_1 contains 3 dimensions.
[DimSize_] Tag
The [DimSize_] tag is used to retrive the size of a given array dimension.
Example:
[ArraySet name=array_1&dim=3,4,5][/ArraySet]
[ArrayGet name=array_1]
array_1 has [NumDims] dimensions:
[loop start=1&end=[NumDims]]
Dimension [index] has [interpret][DimSize_[index]][/interpret] indexes.
[/loop]
[/ArrayGet]
Results:
array_1 has 3 dimensions:
Dimension 1 has 3 indexes.
Dimension 2 has 4 indexes.
Dimension 3 has 5 indexes.
And, again, you can access the dimension sizes using the global 'array name'
tag, as follows:
[ArraySet name=array_1&dim=3,4,5][/ArraySet]
array_1 has [array_1(NumDims)] dimensions:
[loop start=1&end=[array_1(NumDims)]]
Dimension [index] has [interpret][array_1(DimSize_[index]])][/interpret] indexes.
[/loop]
Results:
array_1 has 3 dimensions:
Dimension 1 has 3 indexes.
Dimension 2 has 4 indexes.
Dimension 3 has 5 indexes.