Coding with SPIP 3.0
SPIP3.0 Technical Documentation

> > > Quick overview

Quick overview

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:

  1. <B_art>
  2. <ul>
  3. <BOUCLE_art(ARTICLES){!par date}{0,5}>
  4. <li><a href="#URL_ARTICLE">#TITRE</a></li>
  5. </BOUCLE_art>
  6. </ul>
  7. </B_art>

Download

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:

  1. <ul>
  2. <li><a href="Recursion">Recursion</a></li>
  3. <li><a href="Parameter">Parameter</a></li>
  4. <li><a href="Argument">Argument</a></li>
  5. <li><a href="Modifying-all-of-your-templates-in">Modifying all of your templates in one hit</a></li>
  6. <li><a href="Display-an-authoring-form-if">Display an authoring form, if authorised</a></li>
  7. </ul>

Download