Table of contents
The articles loop is coded by placing ARTICLES
(with an “S”) in parentheses.
<BOUCLEn(ARTICLES){criterion...}>
Note. An ARTICLES
loop only returns published articles. There are no means of displaying articles with the status of “editing in progress”, “submitted for evaluation” or “rejected”.
The selection criteria
We will use one of the following criteria to indicate how we will select the articles:
- {tout}
, i.e. “all”, will select all the articles from all sections (rubriques) available on the site. This is particularly useful for displaying the most recent articles from the whole site on the home page or what’s new page. [Actually, the criterion “tout” is not treated in a data-processing way: it’s an aide-memoire for the Webmaster; you can obtain the same results by omitting all of the following criteria.]
- {id_article}
returns the article identified by id_article
. Since the identifier of each article is unique, this criterion will only return a single response or none.
- {id_rubrique}
returns all the articles available in the current section (rubrique).
- {id_secteur}
returns all the articles available in the current sector (a sector or main section is a root level heading and includes all its sub-sections).
- [SPIP 1.4] {branche}
returns all of the articles in the section AND its sub-sections. It is a kind of extension of the {id_secteur}
criterion. However, contrary to {id_secteur=2}
, it is not possible to call another branch directly, for example: {branche=2}
, but only the section currently in context may be called. This criterion should be used with care; if your site is well structured, you should not need it, except in very special cases.
- {id_auteur}
returns a list of articles associated with the corresponding author identifier.
- {id_mot}
returns a list of articles corresponding to this keyword identifier (useful when creating a list of the articles relating to a given subject).
- [SPIP 1.3] {titre_mot=xxxx}
, or {type_mot=yyyy}
returns the articles related to the keyword named “xxxx”, or related to keywords in the keyword group “yyyy”. Note, you cannot use several {titre_mot=xxxx}
or {type_mot=yyyy}
criteria in the same loop.
- [SPIP 1.4] {id_groupe=zzzz}
makes it possible to select the articles related to a group of keywords; it is similar to {type_mot}
above, but since it works with an identifier (the group number), syntax is cleaner. [Note: This criterion is not (in the current state of the development of SPIP) compatible with {type_mot=yyyy}
]
- [SP<font
color="yellow">IP
1.7.1] {lang}
returns the articles that exist in the language shown in the page URL.
- [SP<font
color="yellow">IP
1.7.2] The {date}
(or {date=...}
or {date==...}
) criteria return an article according to the date passed in the URL.
- {recherche}
e.g. “search”, returns the articles corresponding to the words indicated in the search interface (search engine incorporated to SPIP). Refer to the article dedicated to the Search engine.
Display Criteria
Once you have specified the selection criteria, you will be able to add the following criteria to restrict the number of displayed elements.
- The criteria common to all loops apply here.
- {exclus}
makes it possible to exclude the current article from the result set (for example, when you display the articles contained in the same heading, you may not want to display a link to the currently displayed article).
Tags of this loop
Tags retrieved from the database
The following tags represent the items retrieved from the database (as opposed to those that are “calculated” and are explained later). You can also use them as sorting criterion (for example, {par titre}
by title or {par date}
by date).
- #CHAPO
returns the introductory paragraph to the article, sometimes known as the ’standfirst’.
- Dates: #DATE
, #DATE_REDAC
, #DATE_MODIF
are documented in the dates management.
- #DESCRIPTIF
returns the description.
- #ID_ARTICLE
returns the unique identifier of the article. Useful for building custom hypertext links to the article (for example towards a “printer friendly” page).
- #ID_RUBRIQUE
returns the identifier of the section (rubrique) to which the article belongs.
- #ID_SECTEUR
returns the identifier of the sector on which the article depends (the sector being the section located at the root of the site).
- #LANG
returns the language of the article.
- #POPULARITE
returns the popularity rating of this article as a percentage. See the documentation on the popularity of articles.
- #PS
returns the postscript.
- #SOUSTITRE
returns the subtitle.
- #SURTITRE
returns the surtitre field, the top title.
- #TEXTE
returns the main text of the article.
- #TITRE
returns the title of the article.
- #NOM_SITE
and #URL_SITE
correspond to the « hyperlink » of the article (if you have activated this option in the site configuration).
- #VISITES
returns the number of visits recorded for this article.
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
: [SPIP 1.4] returns the article’s description if it exists, failing that it returns the first 600 characters of the article (introduction then text). [SPIP 1.3] In the preceding versions of SPIP, only the first characters of the article (introduction then text) are taken into account (the description is not used).
- #LESAUTEURS
returns the authors of this article. This makes it unnecessary to create an AUTEURS
loop to obtain the same result.
- #PETITION
gives the text of the petition associated with the article (if there is one). If a petition exists, but has no text, then this tag returns a space — which is without effect in an HTML page.
- #URL_ARTICLE
is the complete URL of the article’s page.
- #FORMULAIRE_FORUM
creates the forum interface for this article
- #FORMULAIRE_SIGNATURE
creates the petition interface for this article.
- #PARAMETRES_FORUM
returns a list of the variables needed to create a link to the forum making it possible to respond to this article in the forum. For example:
[ <a href="forum.php3?(#PARAMETRES_FORUM)">Comment on this article </a> ]
Logos
- #LOGO_ARTICLE
displays the article’s logo, including the optional hovering logo if one has been included for the article.
- #LOGO_ARTICLE_RUBRIQUE
displays the article’s logo if one exists, if not it displays the section’s logo.
- #LOGO_RUBRIQUE
displays the section’s logo.
The logo tags are formatted as follows:
[ (#LOGO_ARTICLE|alignment|address) ]
Alignment can be left
or right
. Address is the target URL if the logo is used as a link. If you do not specify an address the logo is not clickable.
The above tags create complete HTML code to insert the logo in the page. If you want to directly recover the logo’s filename, for example to post an image as a table background, you should use the |fichier
filter as follows:
[ (#LOGO_ARTICLE|fichier) ]
In addition, two tags make it possible to recover only one of the two logos:
- #LOGO_ARTICLE_NORMAL
is the base logo
- #LOGO_ARTICLE_SURVOL
is the hovering logo.