FreedomSoft - "the future is freedom"
Repeat/Loop - Introduction

It is often necessary to output the same HTML, or the same portion of a template, multiple times. The number of times may vary, as well.

Generally, repeat is used to repeatedly output rows within a table.

For example, if you want to list all the records in a table, so the user can select from the records in that table, you cannot know when creating the template, how many times you should repeat the HTML that actually lists each record. Instead, you would define that HTML once, then use a repeat to loop through that HTML as many times as was necessary.

The primary parameters for the Repeat tag are: %R [System_Class] [NumberOfRepeats]%. Please note that there are other parameters as well. Only the most important parameters are listed here. Either or both System_Class and NumberOfRepeats can be set. If only System_Class is set, then the repeat will loop until all appropriate data within that System_Class has been output. If only NumberOfRepeats is set, then the repeat will loop that number of times. If both are set, then the repeat will loop while both are true - as soon as all appropriate data has been output from the class, OR as soon as the NumberOfRepeats has been met, the repeat will stop looping.

We say 'appropriate' data in the previous paragraph, as the last command executed will determine what records within the table will be output. If the last command was view all, then all records will be 'appropriate'. If the last command was a Search command, then only the records matching the search criteria will be 'appropriate'.

For example:

<table>
 <tr>
  <td>Customer Name</td>
  <td>Customer Address</td>
 </tr>
%R EXAMPLES_CUSTOMERS 15%
 <tr>
  <td>%EXAMPLES_CUSTOMERS_NAME%</td>
  <td>%EXAMPLES_CUSTOMERS_ADDRESS%</td>
 </tr>
%/R%
</table>

In the above example, the table row outputting the customer name and address, will be repeated a maximum of 15 times, or until there are no more 'appropriate' Customer records left to be output. Freedombase will move the pointer forward from one Customer record to the next, every time %EXAMPLES_CUSTOMERS_NAME% is reached, making this a simple way to output multiple records on the page.

previousnext
12345678910111213141516171819

    navigate     introduction     tags     attributes     expressions     include/insert     security     repeat/loop     command     creating     edit     update     custom code