The SITES loop (or Syndication)

The SITES loop [SPIP 1.3] returns a list of referenced sites.

<BOUCLEn(SITES){criteria... }>

If referenced sites are syndicated, this loop is also associated with a SYNDIC_ARTICLES loop which makes it possible to retrieve a list of articles from these sites.

Historical note: Before version 1.3 of SPIP, this loop was named SYNDICATION because only syndicated sites could be referenced. The two versions are exactly the same, but "SITES" corresponds better to the fact that, since version 1.3, it is about a system of referencing sites, the syndication being optional.

<BOUCLEn(SYNDICATION){criterion... }>

Selection Criteria

You should use one of the following criteria to indicate which sites are selected.

-  {tout} returns all referenced sites.

-  {id_syndic} returns the referenced site identified by id_syndic.

-  {id_rubrique} returns the sites referenced in this section.

-  {id_secteur} returns the sites referenced in this sector.

-  {id_mot} [SPIP 1.3] returns the sites related to the current keyword (inside a MOTS loop, or a URL parameter).

-  {titre_mot=xxxx} [SPIP 1.3] , or {type_mot=yyyy} returns the sites related to the keyword named "xxxx", or related to keywords in the keyword group named "yyyy". If you provide several {titre_mot=xxxx} criteria (or several {type_mot=yyyy} criteria), you will select those that have ALL of those keywords at the same time (introduced in SPIP 1.9).

-  {id_groupe=zzzz} (since SPIP 1.4 ) allows you to select the sites related to a keyword group; effectively the same as {type_mot} above, but since an identifier (number of the group), the syntax of the internal code will be cleaner.

Display Criteria

You can use any of the criteria applicable to all loops.

-  {syndication=oui}, or {syndication=non} (since SPIP 1.3) are used to display only the referenced sites that are subject to syndication, or which are only referenced without being syndicated.

-  {moderation=oui} (since SPIP 1.4 ) displays the syndicated sites whose links are initially blocked pending moderation; the reverse of this criterion is {moderation!=oui}.

Tags of this loop

-  Tags retrieved from the database

The following tags correspond to the elements retrieved directly from the database. You can also use them as sorting criteria (in general: {par nom_site}).

-  #ID_SYNDIC is the unique identifier of the syndicated site. For example, to return the page describing the site (site.html in /dist) with the following code:

<BOUCLE_sites(SITES) {id_rubrique} {par nom_site}>
<li><a href="[(#ID_SYNDIC|generer_url_site)]">#NOM_SITE</a></li>

Caution!: This code is only valid for SPIP versions < 2.0.0. For versions 2 of SPIP, you need to use the following code instead:

<BOUCLE_sites(SITES) {id_rubrique} {par nom_site}>
<li><a href="[(#ID_SYNDIC|generer_url_entite{site})]">#NOM_SITE</a></li></BOUCLE_sites>

-  #NOM_SITE is the name of the syndicated site.

-  #URL_SITE is the (URL) address of the syndicated site.

-  #DESCRIPTIF is the description of the syndicated site.

-  #ID_RUBRIQUE is the section number containing this syndication.

-  #ID_SECTEUR is the sector number (section at the root of the site) containing this syndication.

-  Other tags

-  #LOGO_SITE returns the logo assigned to the site.

-  #URL_SYNDIC returns the (URL) address of the syndication file of this site.

-  #FORMULAIRE_FORUM generates and displays the form used for posting forum messages about this site. For more information on this, see also "Forms".

-  #PARAMETRES_FORUM generates the list of variables used by the form interface used for posting forum messages about this site. For instance: [<a href="spip.php?page=forum&(#PARAMETRES_FORUM)">Respond to this forum</a>]

Since [SPIP 1.8.2], it has been possible to pass a parameter specify the return address to be redirected to after having posted the message. For example: <a href="spip.php?page=forum&(#PARAMETRES_FORUM{#SELF})">Respond to this message</a> will redirect the visitor tback to the current page once the message has been validated.

Historical note: In versions prior to SPIP 1.9, you need to code this as forum.php3? and not spip.php?page=forum&

Generally speaking prior to SPIP 1.9, the URLs of SPIP generated pages where of the form: and not like as the are in the current version.

Author Paolo, Paul Knight Published : Updated : 26/10/12

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