Table Rows

As of March 2017, Branch Code is deprecated and no longer developed. Use the Twig syntax instead.

There are times when you need to output a table with a certain number of columns in each row and each column is essentially the same.  The {row}{/row} set of tags provides that functionality.

The {row} tag is intended to display a row of content with the same template for each column in the row. If there is not enough content to fill a row then a template for empty columns can be set. This tag would most commonly be used for tables that have the same layout for each column of the table (i.e. display a table of images with a name).

This is similar to the {loop} structure.  One difference, though, is that the data for each column is always only accessible through the {#column} variable.

Sample Code

The following code will output a 3-column table where each column contains an image and the name of the item.

  <table>
    {row data="#rowData" columns="3"}
      <tr>
        {column}
          <td>{#column.image}<br />{#column.name}</td>
        {/column}
        {emptyColumn}
          <td>&nbsp;</td>
        {/emptyColumn}
      </tr>
    {/row}
  </table>

Code Explanation

Tag Description
{row} Marks the beginning of a table row.
Parameters:
data: The variable that the information for the row will come  from.
columns: The number of columns in each row
Example: {row data="#rowData" columns="3"}
{/row} Marks the end of a table row
Example: {/row}
{column} Marks the beginning of a column that will contain data.
Example: {column}
{/column} Marks the end of a column that will hold data.
Example: {/column}
{emptyColumn} Marks the beginning of a column for which there is no data. This could be the case if there was only enough data to fill two out of three table columns.
Example: {emptyColumn}
{/emptyColumn} Marks the end of a column for which there is no data.
Example: {/emptyColumn}
{#column} Holds the data for that particular column as an Array.
{#apColumnNumber} Holds the column number.