Created
October 5, 2020 09:38
-
-
Save motsmanish/c1827ca6c0faa49899bebef09af3f8b9 to your computer and use it in GitHub Desktop.
Pagination code for Cakephp 4 + Bootstrap 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this->Paginator->setTemplates([ | |
'first' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'prevActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'prevDisabled' => '<li class="page-item disabled"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'current' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'nextActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'nextDisabled' => '<li class="page-item disabled"><a class="page-link" href="{{url}}">{{text}}</a></li>', | |
'last' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>' | |
]); | |
?> | |
<div class="mx-auto"> | |
<nav aria-label="Page navigation"> | |
<ul class="pagination justify-content-end"> | |
<?= $this->Paginator->first('first') ?> | |
<?= $this->Paginator->prev('previous') ?> | |
<?= $this->Paginator->numbers() ?> | |
<?= $this->Paginator->next('next') ?> | |
<?= $this->Paginator->last('last') ?> | |
</ul> | |
</nav> | |
<?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p> | |
</div> |
Very well done. Do you know where we can put this template so that it applies to every paginator?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is how it looks: