PUBLISHED : {pagination}

**SPIP**

# Article validated

The article "**{pagination}** ({pagination} - SPIP)"
was validated by <multi>[ar]جورج[fr]George [en]George</multi>.

* * *

## {pagination}

Thursday 14 May 2020 , by [jack](.././?page=auteur&id_auteur=593&)

When a loop returns several dozen articles (or, for a petition, several
thousand signatures), it is undesirable, if not impossible, to display
everything on a single page.

To set up the page numbering system, you have to add to your loop the
`{pagination}` criterion thus:

    <B_page>

    #PAGINATION

        <ul>

    <BOUCLE_page

    (ARTICLES)

    {par date}

    {pagination}

    >

        <li>
    
    #TITRE
    
    </li>

    </BOUCLE_page>

        </ul>

    </B_page>

You notice the use of the `#PAGINATION` necessary in the page numbering
mechanism. If the site has 90 published articles, this loop will display
the list of the ten oldest articles, with links to the page that displays
the next ten, the ten after that, etc. These links are numbered as follows:

0 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | ...

The number from which the results are displayed is passed to the url via
the parameter `{debut_page=x}` with the same name (here, "page") than the
loop in question. (This parameter can be used in another loop via the
classic criterion `{debut_page,10}`.)

Note: the total number of links displayed is limited; ellipsis allow, if
necessary, to go directly to the very end of the list, or to go back to the
very beginning.

## Changing the range of the `{pagination}`

The standard number of 10 elements per page can be changed by an additional
parameter in the criterion.

Hence

    <BOUCLE_page (ARTICLES)
    
    {pagination 5}
    
    >

    #TITRE

    </BOUCLE_page>

will return the titles of five articles starting at debut_page.

The parameter in question can itself be composed as desired from other
tags, such as `#ENV{xx}`, which allows for a very comprehensive on-demand
display.

— Sent by SPIP (https://www.spip.net/)

rubon199.jpg