[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

Home > English documentation > Webmasters > A few examples of loops > To sort articles alphabetically, except one which should be displayed (...)

To sort articles alphabetically, except one which should be displayed first

November 2003 — updated on : August 2010

All the versions of this article:

Let us suppose that you want to list a series of articles alphabetically, except the prologue which you want to display at the beginning of the list...

There is an easy way to deceive the sorting carried out by SPIP: you just have to add a space at the beginning of the article’s title (for example, change "Prologue" to " Prologue". This will sort the prologue title before the others and will display it first. However the additional space in the title will be ignored by the web browser and will not cause any variation to the page layout.

Note: this trick will only work if you use an alphabetical sorting on article titles, by using the following sort criterion on the loop {par titre}). It won’t work for any other sort order.

Note: this also applies to sections, news items, referenced sites, etc.

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