#CHAMP_SQL is used to extract any SQL field associated with a loop.
  • New in : SPIP 2.0

The #CHAMP_SQL tag can be used in any loop and makes it possible to retrieve a field value from an SQL table.
#CHAMP_SQL is very useful when a tag of the same name as the field already exists in SPIP (with multibases, for example).

Let’s look at the example of The search loops and tags which are included in the core of SPIP; to extract a #POINTS field, we absolutely must use #CHAMP_SQL{points}, otherwise SPIP’s compiler will assume that we are calling the #POINTS tag which may only occur inside a loop that uses the {recherche} criterion.

Remarks: The #CHAMP_SQL tag can not use a dynamically referenced parameter value - it absolutely must be a constant which is used as the parameter. #CHAMP_SQL{points} works correctly, but #CHAMP_SQL{#GET{champ}} will fail.

Author Mark Published : Updated : 14/07/23

Translations : عربي, català, English, Español, français, Nederlands