A loop typically declares both a database table from which to extract information as well as the criteria to be used for selecting a subset of the table’s records.
<BOUCLE_loopname(TABLE){criterion1}{criterion2}>
... code to be applied for each member object selected by the loop ...
</BOUCLE_loopname>
Every loop has it’s own name identifier which must be unique within the template file. This name is used together with the reserved word “BOUCLE” (English: "loop") in order to mark the start and the end of the loop. In this example, the loop’s name is “_loopname”.
The table is specified either by an alias (written in capital letters) or by the real name of the table (matching the case), for example “spip_articles”. The example uses the “TABLE” alias.
This loop declaration is then followed by the criteria, each of which is always written enclosed in braces. For example, the criterion {par nom}
will sort the results according in ascending order of the contents of the “nom” column of the database table.