#INFO_XXX

  • New in : SPIP 3.0

#INFO_XXX{objet_type, id_objet} is a tag that allows you to retrieve the value of a field in the database without necessarily making a boucle.

It takes three mandatory parameters:

  1. XXX: the name of the field
  2. object_type: this is the type of the object [1] function corresponding to the SQL table you want to query (e.g.: article for the spip_articles table, forum for the spip_forum table, etc.).
  3. object_id: this is the id of the targeted object.

Off-loop use

#INFO_TITRE{article,  13}
#INFO_NOM{auteur,  2}

This feature is optimised to avoid making multiple SQL queries on the same table. So you can use the tag several times on the same object without worrying.

#INFO_TITRE{article, 13}
#INFO_SOUSTITRE{article, 13}
#INFO_CHAPO{article, 13}

Also parameters can be passed dynamically:

#SET{id_breve,  3}
#INFO_TITRE{breve,  #GET{id_breve}}

Use in a loop

<BOUCLE_article(ARTICLES){id_article}>
Here's the article #TITRE of the section #INFO_TITRE{rubrique,  #ID_RUBRIQUE}
</BOUCLE_article>

...works well since #ID_RUBRIQUE is a field from the table spip_articles

Automatic processing

The tag applies the usual automatic processing to the requested information, exactly as when #TITRE or #TEXTE is requested in a loop of the object. It therefore takes into account multi tags or SPIP syntax on certain fields.

To disable them, it is necessary to add the asterisk [2], just like the other tags: #INFO_TEXTE*{article, 123}.

Specificities

For TITRE, the tag will look for the definition of the title field in the description of the editorial object [3], which then allows to use the same syntax whatever the content, even if in the database it is the "name" field that is important.

Thus #INFO_TITRE{auteur, 123} will return the signature of this user, stored in the "nom" field of "spip_auteurs".

See also

Tags available throughout the site

Footnotes

[1see on this subject the objet_type()

[2see #TAG* and #TAG**, as well as the Automatic tag processes

[3see on this subject the API for declaring editorial objects

Author jack Published : Updated : 14/07/23

Translations : English, français, Nederlands