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

The RUBRIQUES Loop (Sections)

October 2003 — updated on : November 2010

All the versions of this article:

The RUBRIQUES loop returns a list of... sections (rubriques in French, so it’s not particularly surprising, really)

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


Note. A RUBRIQUES loop only displays "active" sections, i.e. those containing published articles, attached documents (from [SPIP 1.4]), published sites or active sub-sections. In this way, you avoid empty sections which do not offer any navigation. Since SP<font color="yellow">IP 1.7.1, it has been possible to force the display of such otherwise "empty" sections (see below).

Selection Criteria

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

-   {id_rubrique} returns the section identified by id_rubrique. As the identifier of each section is unique, this criterion will only ever return a single section or none.

-   {id_secteur} returns a list of the sections in the sector identified by id_secteur. You can also, by extension, use the {branche} criterion described in the ARTICLES loop to return all sections in the section that is currently in context.

-   {id_parent} returns a list of the sections contained in the section identified by id_parent.

-   {racine} returns a list of the sectors in the root level (identical to {id_parent=0}).

-   {id_enfant} returns the section which contains the section identified by id_enfant (only one record; or no record if the section is located at the root of the site).

-   {meme_parent} returns a list of the sections which have the same parent section as the current section. This makes it possible to display sections which are on the same level in the hierarchy.

Starting from version [SPIP 1.4], sections can be related to keywords. Keyword criteria can therefore be used in the (RUBRIQUES) loops:

  • {id_mot}, {titre_mot=xxx} retrieves the sections related to the keyword identified by id_mot or by its title which is titre_mot;
  • {id_groupe}, {type_mot=yyyy} retrieves the sections related to the keyword group identified by id_groupe or by its title which is type_mot.

-   {recherche} returns the sections corresponding to the words indicated in the search interface of the built-in search engine. See the page devoted to the search engine.

-   {lang} (since SP<font color="yellow">IP 1.7.1) will select the sections tagged with the nominated language in the page’s address.

-   {tout}, since [SP<font color="yellow">IP 1.7.1] will display all the empty sections as well as sections containing published elements.
-  However, this choice must be restricted to very specific needs; as a matter of fact, SPIP does not display, by default, sections not containing any active element, in order to guarantee that the site will not contain “dead ends” (pages without any content).

Display criteria

Once you have specified the selection criteria above, you will be able to add the following criteria to restrict the number of displayed elements.

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

-   {exclus} is used to exclude the current section from the result set (useful with meme_parent).

Tags for this loop

-  Tags retrieved from the database

The following tags represent the items retrieved directly from the database. You can also use them as sorting criterion (for example, {par titre} by title).

-  #ID_RUBRIQUE returns the unique identifier of the section.

-  #TITRE returns the section’s title.

-  #DESCRIPTIF returns the section’s description.

-  #TEXTE returns the section’s main text.

-  #ID_SECTEUR displays the identifier of the sector on which the section depends (the sector being the section located at the root of the site).

-  #ID_PARENT displays the identifier of the parent section. If this section is located at the root of the site, it will return 0.

-  #LANG returns the section’s language.

-  Tags calculated by SPIP

The following elements are calculated by SPIP. They cannot be used as sorting criteria.

-  #NOTES returns the footnotes (calculated from an analysis of the text).

-  #INTRODUCTION returns the first 600 characters of the text. Applied styles such as bold and italic are removed.

-  #URL_RUBRIQUE is the URL of the section’s page.

-  #DATE since [SPIP 1.4] displays the publication date of the most recent element (articles, news items...) published in the section and/or any of its sub-sections.

-  #FORMULAIRE_FORUM creates and displays the forum interface for this section. For more information, please also see "Forms".

-  #PARAMETRES_FORUM returns a list of the variables needed to create a link to the forum making it possible to comment on this section in the forum. For example:

-  #PARAMETRES_FORUM generates the list of variables used by the form’s interface that make it possible to respond to this section. For example:

Since SPIP 1.8.2, you can pass this tag a parameter specifying the return address to be used after having posted the message. For example: <a href="spip.php?page=forum&(#PARAMETRES_FORUM{#SELF})">Respond to this section</a> will forward the site visitor BACK to the same current page once their message has been validated and processed.

Historical note: In version prior to SPIP 1.9, it was necessary to code this as forum.php3? and not as spip.php?page=forum&
Generally speaking, prior to SPIP 1.9, URLs of page generated by SPIP were of the form: http://mysite.net/xxx.php3 and not as http://mysite.net/spip.php?page=xxx.

-   #FORMULAIRE_SITE (since SPIP 1.4 ) generates and displays an interface making it possible for visitors to suggest links to referenced sites. These links will be held internally as "proposed" links until validated by an administrator.

This form is only displayed if you activated the option "Manage web sites directory" in the site configuration area of the administrators panel, and if you set "Who can propose referenced sites?" to include "visitors of the public site".

-  Logos

-  #LOGO_RUBRIQUE is the section’s logo, including an optional hovering logo. If there is no logo for this section, SPIP will automatically search upwards in the section hierarchy and will display the first available logo.

The logo tags are formatted as follows:

[(#LOGO_RUBRIQUE|alignment|address)]

Where:

  • alignment is the alignment value for the logo (left or right)
  • address is a URL if you want to add a link directly on the logo (e.g. #URL_RUBRIQUE).

If you want to directly recover the logo’s filename, you should use the |fichier filter as follows: (#LOGO_ARTICLE

Since SPIP 1.4 : #LOGO_RUBRIQUE_NORMAL displays the base logo; #LOGO_RUBRIQUE_SURVOL displays the hovering (mouseover) logo: these two tags allow more control over the display of the two logos. For instance, when we are in a section, they allow us to manage a logo "with hovering" as a link to other sections and to leave a logo alone (without hovering) for the section we are in.

[SPIP 2.1]

Note: there is a new syntax for the LOGO_XX tags.


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