pagination
Generate a list of page navigation links on a page
Example
[%pagination total_items:'153' items_per_page:'24' current_page_num:'2'%]
[%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 generates a list of page links on a category page, though, it can be used with other page types. It gives you the flexibility to style the previous, current, next pages separately.
Parameters
Name | Options | Description |
---|---|---|
`items_per_page:''` | Integer | Number of results per page |
`total_items:''` | Integer | Total number of items in the list |
`current_page_num:''` | Integer | The number of the currently selected page |
`near_by_pages:''` | Integer | Limits the number of pages displayed before and after the current page. The last past will be added to the end of the list |
`qs_name:''` | String | By default, the function uses the query variable name `pgnum`. This setting will rename this varibable |
`*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 |