SPIP

[ar] [ast] [bg] [br] [ca] [co] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [ru] [sk] [sv] [tr] [uk] [vi] [zh] Espace de traduction

Download

#CHAMP_SQL

August 2010

All the versions of this article:


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.

In general, SPIP’s developers have used field names that do not coincide with functional tag names, meaning that this tag is normally only used when referencing custom fields or fields in custom tables that you are not at liberty to rename in order to avoid such confusion in the SPIP compiler.


Show the template of this page Site powered by SPIP | Translation area | Private area