The RUBRIQUES Loop (Sections)

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


Note. A RUBRIQUES loop only displays "active" sections, i.e. those containing published articles, attached documents, published sites or active sub-sections. In this way, you avoid empty sections which do not offer any navigation. It is 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.

-   {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} will select the sections tagged with the nominated language in the page’s address.

-   {tout}, 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 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 generates the list of variables used by the form’s interface that make it possible to respond to this section. For example:

[<a href="spip.php?page=forum&(#PARAMETRES_FORUM)">Respond to this section</a>]

You can pass it a parameter specifying the return address after posting 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.

-   #FORMULAIRE_SITE 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.

It is possible to disable this heritage with _LOGO_RUBRIQUE_DESACTIVER_HERITAGE.

#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.

See also: The #LOGO_XXX tags

Author Paolo, Paul Knight Published : Updated : 05/04/23

Translations : عربي, català, Deutsch, English, Español, français, italiano, Nederlands, русский, українська