pagination

Generate a list of page navigation links for a list, thumb_list, or any other function tag that supports the pgnum param

Example

[%pagination total_items:'[@total_items@]' items_per_page:'[@items_per_page@]' current_page_num:'[@current_page@]'%]
    [%param *header%]
        <ul class="pagination" aria-label="Pagination navigation">
    [%/param%]
    [%param *previous_page%]
        <li><a href="[@url@]" aria-label="Go back one page"><i class="fa fa-caret-left" aria-hidden="true"></i></a></li>
    [%/param%]
    [%param *goback_pages%]
        <li><a href="[@url@]"  aria-label="Go to page [@page@]">[@page@]</a></li>
    [%/param%]
    [%param *current_page%]
        <li class="active"><a href="[@url@]" aria-label="Current page">[@page@]</a></li>
    [%/param%]
    [%param *gonext_pages%]
        <li><a href="[@url@]" aria-label="Go to page [@page@]">[@page@]</a></li>
    [%/param%]
    [%param *next_page%]
        <li><a href="[@url@]" aria-label="Go forward one page"><i class="fa fa-caret-right" aria-hidden="true"></i></a></li>
    [%/param%]
    [%param *footer%]
        </ul>
    [%/param%]
[%/pagination%]

Usage

The pagination function can be used instead of the paging function to generate a list of next/previous page links on a category or content page, or anywhere paging can occur. This function provides some additional params over the paging function to tweak the results. Giving more flexibility to style the previous, current, and next pages links to suit your webstore design.

Parameters

Name Options Description
`total_items:''` Integer or b@se tag Total number of items in the list, this can be pulled in dynamically using `[@total_items@]` or `[@total_results@]` (whichever is in scope for the function you are using)
`items_per_page:''` Integer or b@se tag Number of results per page, this can be pulled in dynamically using `[@items_per_page@]` or `[@limit@]` (whichever is in scope for the function you are using)
`current_page_num:''` Integer or b@se tag The number of the currently selected page, this can be pulled in dynamically using `[@current_page@]` or `[@form:pgnum@]`
`near_by_pages:''` Integer or b@se tag Set the max number of pages displayed before and after the current page. Will default to `10` if omitted
`qs_name:''` String or b@se tags Set the name of the URL query used to indicate the current page. E.g. if `qs_name:'page'` is set, the paging URL would be `/?page=2`. Will default to `pgnum` if omitted
`*header` HTML & b@se tags Renders a single usable space above the body
`*current_page` HTML & b@se tags Renders in the list when the current page matches the value in the `current_page_num:''` param
`*goback_pages` HTML & b@se tags Renders in the list when there is a previous page to the current page. Used to link to the previous page
`*gonext_pages` HTML & b@se tags Renders in the list when there is another page after the current page. Used to link to the next page
`*next_page` HTML & b@se tags Renders the link to the next page after the currently selected page
`*previous_page` HTML & b@se tags Renders the link to the next page after the currently selected page
`*footer` HTML & b@se tags Renders a single usable space below the body
`ifempty:''` or `*ifempty` HTML & b@se tags If the pagination function returns no results, it'll load this block instead

Data Tags (current_page, goback_pages, gonext_pages, next_page, previous_page)

Name Example Description
`[@page@]` 2 Page number
`[@url@]` /fiction?pgnum=2 Web address to the page

Was this article useful?

Be notified when this page is updated. Optional.