The criterion {inverse} reverses the sort order of the previous criterion.

The criterion {inverse} reverses the sort order of the previous criterion. For example: while {par date} will sort the items starting with the oldest, {par date}{inverse} will sort the list starting with the most recent.

Criterion {inverse} is therefore always used in association with a previously specified sorting criterion. See also the page of the criterion {par ...}.

In the case of multiple sorting criteria, for example: {par titre, date} which sort first alphabetically on the titles (from A to Z) and then, for identical titles sort by date (from the oldest to the most recent), the application of the criterion {inverse} (thus writing {par titre, date} {inverse}) will reverse the order only on the last specified sorting field (here: date which will be sorted from the most recent to the oldest) and will keep the default sorting order on the previous fields (here: titre will remain sorted from A to Z).

If you want to specify a reverse order for the two fields concerned, you will have to write:
{par titre} {inverse} {par date} {inverse}.

Since SPIP 1.9, the citerion {inverse} can take as argument any tag that will modify dynamically the sorting direction.
For example, it is possible to write:
<BOUCLE_example(ARTICLES) {par #ENV{tri}} {inverse #ENV{senstri}}>
which allows you to choose the sorting column and the sorting direction given by the url; for example: tri=titre&senstri=0 which is equivalent to {par titre} or tri=date&senstri=1 which is equivalent to {par date} {inverse}.

See also {par ...}

Author jack Published :

Translations : English, français, Nederlands