Template Tags
Variables
The following variables are available in both Simple Table and Simple Grid tag pairs.
{row_id}
{total_rows}
{total_columns}
{count}
{index}
{heading_row}
{is_first_row}
{is_last_row}
{switch="a|b"}Parameters
prefix=""The prefix parameter is no longer necessary for Simple Grid fields as of version 1.7. It is deprecated and may not work as expected . It still works in Simple Table fields.backspace=""
Template Code Examples
Heading Rows
As of version 1.5 of Simple Grids & Tables you can optionally enable adding a Heading Row button to each grid or table field. When a Heading Row is added it will span all columns in the grid or table field, which requires slightly different rendering behavior in the template. The Heading Row variable name can not be changed and it's behavior is the same in both a Simple Grid and Simple Table field, thus the following template logic can be used when rendering either field in the template.
Simple Table (standalone)
Note you can optionally prefix all of Simple Grid and Simple Table field variables with the prefix="" parameter.
Since Simple Table does not have named columns, all of the column values are available with the {value} variable. The {column_heading} variable will print the column values from the first row for every row in the loop. If you're using the first row as a heading, then this variable can be useful to improve accessibility, or simply having to not hard-code the value of the first row in your templates.
Simple Table (inside Grid)
Simple Table (inside of Fluid)
Simple Table (inside Bloqs)
Simple Table (as a Pro Variable)
Simple Grid (standalone)
Unlike Simple Table, Simple Grid does have named columns. The column labels or headings are defined in the control panel, thus there is no need for a {column_heading} variable. In this case the column names are {product} and {price}. Simple Grid operates very similarly to the native Grid field, but does not have variable modifiers such as :sum or :average.
Any tag pairs inside of a Simple Grid field need to be prefixed with the Simple Grid field name. For example:
{my_simple_grid_field}
{my_simple_grid_field:my_file_field}
{url}
{/my_simple_grid_field:my_file_field}
{/my_simple_grid_field}
Prefixing is not required when using Twig or Blade.
Simple Grid (inside Grid)
Simple Grid (as a Low Variable)
Date and Date with Timezone fields
Simple Grid contains a Date and Date with Timezone field. When using a Date field, the template variable is the name of the column as indicated above, e.g. {my_date_column}
However, when using the Date with Timezone field there are modifiers, e.g. {my_date_column:date} and {my_date_column:timezone}. You essentially get two template variables out of this single column.
File fields
Using a File field in a SImple Grid is the same as using a standalone File field.
Last updated
Was this helpful?