SPIP transforms templates into static pages. Templates are mainly composed of loops (<BOUCLE>
) which select elements, typically sets of records, and tags (#TAG
) which display the properties and values of those elements, typically fields from the records or system-wide functions and preconfigured values.
List the 5 most recently published articles:
<B_art>
<ul>
<BOUCLE_art(ARTICLES){!par date}{0,5}>
<li><a href="#URL_ARTICLE">#TITRE</a></li>
</BOUCLE_art>
</ul>
</B_art>
In this first example, the <BOUCLE_art()>
loop performs a selection from the ARTICLES
table in the database. It sorts the data in reverse chronological order and returns the first five elements.
For each article that the loop selects, the #URL_ARTICLE
tag is replaced with the URL calculated for that article’s page, and the #TITRE
tag is replaced with its title as stored in the database.
Typical HTML resulting from this kind of loop:
<ul>
<li><a href="Recursion">Recursion</a></li>
<li><a href="Parameter">Parameter</a></li>
<li><a href="Argument">Argument</a></li>
<li><a href="Modifying-all-of-your-templates-in">Modifying all of your templates in one hit</a></li>
<li><a href="Display-an-authoring-form-if">Display an authoring form, if authorised</a></li>
</ul>