Tag syntax, the definitive version

Just like loops (boucles), tags often have optional components, and can sometimes also accept parameter arguments. Asterisks can be applied to bypass certain processes that are normally executed automatically for that tag.

  1. #TAG
  2. #TAG{argument}
  3. #TAG{argument, argument, argument}
  4. #TAG*
  5. #TAG**
  6. [(#TAG)]
  7. [(#TAG{argument})]
  8. [(#TAG*{argument})]
  9. [ before (#TAG) after ]
  10. [ before (#TAG{argument}|filter) after ]
  11. [ before (#TAG{argument}|filter{argument}|filter) after ]
  12. ...

Download

How the brackets work

The full syntax, with parentheses and square brackets, becomes mandatory as soon as one of the tag’s arguments also uses parentheses and square brackets, or when the tag contains a filter.

  1. // risk of bad surprises:
  2. #TAG{[(#TAG|filter)]}
  3. // always correctly interpreted:
  4. [(#TAG{[(#TAG|filter)]})]
  5. // although this works in SPIP 2.0, results are not guaranteed:
  6. #TAG{#TAG|filter}
  7. // using a filter means you MUST also use parentheses and square brackets:
  8. [(#TAG|filter)]

Download

For details as to the meaning of the square brackets and parentheses, please refer to the article in the official SPIP documentation: SPIP tag syntax.

Example

Display a link to the home page:

  1. <a href="#URL_SITE_SPIP">#NOM_SITE_SPIP</a>

Display an HTML <div> tag and the contents of the #SOUSTITRE (subtitle) field if it exists:

  1. [<div class="subtitle">(#SOUSTITRE)</div>]

Author Mark Baber Published : Updated : 04/06/10

Translations : English, Español, français