Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > Criteria syntax

Criteria syntax

The loops criteria for are written between curly brackets just after the tables names.

  1. <BOUCLE_name(TABLE){criterion1}{criterion2}...{criterion n}>

Any SQL field in a table can become a selection criterion separated by an operator. But other criteria can be created when necessary. They are defined in the ecrire/public/criteres.php file.

Some tags can also be used as criteria parameters, but it is not possible to use their optional components. In general, the use of square brackets is not possible:

  1. <BOUCLE_name(TABLE){id_table=#TAG}> OK
  2. <BOUCLE_name(TABLE){id_table=(#TAG|filter)}> OK
  3. <BOUCLE_name(TABLE){id_table=[(#TAG)]}> Will fail

Download

Example

This ARTICLES loop has 2 criteria. The first selects the articles where the "id_rubrique" SQL field in the "spip_articles" SQL table equals 8. The second criterion specifies that the results should be sorted in ascending order of those articles’ titles.

  1. <BOUCLE_arts(ARTICLES){id_rubrique=8}{par titre}>
  2. - #TITRE<br />
  3. </BOUCLE_arts>

Download

  • Author :
  • Published :
  • Updated : 17/06/10
  • Translations : English, français