This information object can be access when being within an tablerow block. Similar to the for loop block, it contains all of the members as the forloop variable, but some additional ones regarding the current column position. Please have a look at the ForLoop structure in order to find out more about how to use the various members.
Variable name | Object | Description | Note |
col | int | Describes the current column by index, starting at index 1. | |
col0 | int | Contains the current column by index, starting at index 0. | |
col_first | bool | This value is true if the current element is in the leftmost column of the table. | |
col_last | bool | This value is true if the current element is in the rightmost column of the table. | |
first | bool | This value is true if it is the first element of the loop (not identical to the first row!) | |
index | int | Contains the index of the current element starting by 1. | |
index0 | int | Contains the index of the current element starting by 0. | |
last | bool | This value is true if it is the last element of the loop (not identical to the last row!) | |
length | int | Total number of elements in the loop. | |
rindex | int | Reversed index of the current element, ending at index 1. | |
rindex0 | int | Reversed index of the current element, ending at index 0. |
Example:
<table>
{% tablerow tablerow i in (4..11) cols: 3 %}
{{ i }} col: {{ tablerow.col }}, col0: {{ tablerow.col0 }}, col_first: {{ tablerow.col_first }}, col_last: {{tablerow.col_last }}
{% endtablerow %}
</table>
Output:
<table>
<tr class="row1">
<td class="col1">
4 col: 1, col0: 0, col_first: true, col_last: false
</td>
<td class="col2">
5 col: 2, col0: 1, col_first: false, col_last: false
</td>
<td class="col3">
6 col: 3, col0: 2, col_first: false, col_last: true
</td>
</tr>
<tr class="row2">
<td class="col1">
7 col: 1, col0: 0, col_first: true, col_last: false
</td>
<td class="col2">
8 col: 2, col0: 1, col_first: false, col_last: false
</td>
<td class="col3">
9 col: 3, col0: 2, col_first: false, col_last: true
</td>
</tr>
<tr class="row3">
<td class="col1">
10 col: 1, col0: 0, col_first: true, col_last: false
</td>
<td class="col2">
11 col: 2, col0: 1, col_first: false, col_last: false
</td>
</tr>
</table>