PHP code example of georgringer / numbered-pagination

1. Go to this page and download the library: Download georgringer/numbered-pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

georgringer / numbered-pagination example snippets


$itemsPerPage = 10;
$maximumLinks = 15;
$currentPage = $this->request->hasArgument('currentPage') ? (int)$this->request->getArgument('currentPage') : 1;
$paginator = new \TYPO3\CMS\Extbase\Pagination\QueryResultPaginator($allItems, $currentPage, $itemsPerPage);
$pagination = new \GeorgRinger\NumberedPagination\NumberedPagination($paginator, $maximumLinks);
$this->view->assign('pagination', [
    'paginator' => $paginator,
    'pagination' => $pagination,
]);
xml
<!-- instead of {pagination.hasLessPages} which is 'displayRangeStart > 1' internally -->
<f:if condition="{pagination.displayRangeStart} > 2">
    <li>…</li>
</f:if>

<!-- instead of {pagination.hasMorePages} which is 'displayRangeEnd < lastPageNumber' internally -->
<f:if condition="{pagination.displayRangeEnd + 1} < {pagination.lastPageNumber}">
    <li>…</li>
</f:if>