Skip to content

Instantly share code, notes, and snippets.

@aramis-it
Created November 16, 2016 02:55
Show Gist options
  • Save aramis-it/9d2dea6e0d419a52b3bf2d15ad24c608 to your computer and use it in GitHub Desktop.
Save aramis-it/9d2dea6e0d419a52b3bf2d15ad24c608 to your computer and use it in GitHub Desktop.
pagination, cakephp 3, bootstrap 4
<nav aria-label="Page navigation">
<ul class="pagination">
<?php
$this->Paginator->templates([
'prevActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>'
]);
$this->Paginator->templates([
'prevDisabled' => '<li class="page-item disabled"><a class="page-link" href="{{url}}">{{text}}</a></li>'
]);
?>
<?= $this->Paginator->prev('Өмнөх') ?>
<?php
$this->Paginator->templates([
'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>'
]);
?>
<?= $this->Paginator->numbers() ?>
<?php
$this->Paginator->templates([
'nextActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>'
]);
$this->Paginator->templates([
'nextDisabled' => '<li class="page-item disabled"><a class="page-link" href="{{url}}">{{text}}</a></li>'
]);
?>
<?= $this->Paginator->next('Дараах') ?>
</ul>
</nav>
@lect
Copy link

lect commented Feb 6, 2018

Thanks infokani! This helped me a lot. Her's my version with small improvment (where the active pagenumber is also Bootstraponized)

    <nav aria-label="Page navigation">
        <ul class="pagination">
            <?php
            $this->Paginator->templates([
                '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>',
                'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
                'current' => '<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>'
            ]); ?>
            <?= $this->Paginator->prev() ?>
            <?= $this->Paginator->numbers() ?>
            <?= $this->Paginator->next() ?>
        </ul>
    </nav>

@aramis-it
Copy link
Author

I am glad it helped you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment