allow pagination
This commit is contained in:
parent
eb3fc1c120
commit
03b15b61fd
3 changed files with 9 additions and 2 deletions
|
@ -44,3 +44,9 @@ define('FORBIDDEN_EXTENSIONS', ['swf', 'js', 'html', 'htm']);
|
|||
*/
|
||||
define('PIWIK_URL', false);
|
||||
define('PIWIK_ID', false);
|
||||
|
||||
/**
|
||||
* Number of pages to show before and after the current page in the pagination. e.g. default (5) on page 37:
|
||||
* < 1 ... 32 33 34 35 36 *37** 38 39 40 40 42 ... 115 >
|
||||
*/
|
||||
define("PAGINATION_PADDING", 5);
|
|
@ -45,7 +45,8 @@ class Twig
|
|||
}
|
||||
|
||||
private static function getPaginationFunction() {
|
||||
return new \Twig_Function('paginationFunction', function ($numPages, $page, $padding = 2) {
|
||||
return new \Twig_Function('paginationFunction', function ($numPages, $page) {
|
||||
$padding = PAGINATION_PADDING;
|
||||
$pages = [1];
|
||||
$i = 2;
|
||||
while ($i <= $numPages) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
{% macro pagination(num_pages, page) %}
|
||||
{% import _self as m %}
|
||||
{% set pagearray = paginationFunction(num_pages, page,5) %}
|
||||
{% set pagearray = paginationFunction(num_pages, page) %}
|
||||
<!-- License of svg icons - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) -->
|
||||
<ul class="pagination">
|
||||
{% if page > 1 %}
|
||||
|
|
Reference in a new issue