Created
April 15, 2020 20:30
-
-
Save natanfelles/5704034a949a08bd8e4aee5be8855d24 to your computer and use it in GitHub Desktop.
CodeIgniter 4 Bootstrap Pager
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 | |
/** | |
* @var \CodeIgniter\Pager\PagerRenderer $pager | |
*/ | |
$pager->setSurroundCount(2); | |
?> | |
<nav aria-label="<?= lang('Pager.pageNavigation') ?>"> | |
<ul class="pagination"> | |
<?php if ($pager->hasPrevious()) : ?> | |
<li class="page-item"> | |
<a class="page-link" href="<?= $pager->getFirst() ?>" aria-label="<?= lang('Pager.first') ?>"> | |
<span aria-hidden="true"><?= lang('Pager.first') ?></span> | |
</a> | |
</li> | |
<li class="page-item"> | |
<a class="page-link" href="<?= $pager->getPrevious() ?>" aria-label="<?= lang('Pager.previous') ?>"> | |
<span aria-hidden="true">«</span> | |
</a> | |
</li> | |
<?php endif ?> | |
<?php foreach ($pager->links() as $link) : ?> | |
<li class="page-item<?= $link['active'] ? ' active' : '' ?>"> | |
<a class="page-link" href="<?= $link['uri'] ?>"> | |
<?= $link['title'] ?> | |
</a> | |
</li> | |
<?php endforeach ?> | |
<?php if ($pager->hasNext()) : ?> | |
<li class="page-item"> | |
<a class="page-link" href="<?= $pager->getNext() ?>" aria-label="<?= lang('Pager.next') ?>"> | |
<span aria-hidden="true">»</span> | |
</a> | |
</li> | |
<li class="page-item"> | |
<a class="page-link" href="<?= $pager->getLast() ?>" aria-label="<?= lang('Pager.last') ?>"> | |
<span aria-hidden="true"><?= lang('Pager.last') ?></span> | |
</a> | |
</li> | |
<?php endif ?> | |
</ul> | |
</nav> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment