Code Snippet : Pagination Code with CakePHP and Bootstrap

Bootstrap CSS framework is the most widely used by the front end developer, the reason is simple: because the bootstrap supply various kinds of elements that you can use directly. The process of making a website more quickly.

Including pagination element. I as a user cakephp encountered many problems when combining the output pagination of cakephp with bootstrap. To that end, when I found the solution, I post the code here, so easy to remember for myself or others.

<ul class="pagination pagination-large pull-right">
                        <?php
                            echo $this->Paginator->prev(__('prev'), array('tag' => 'li'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
                            echo $this->Paginator->numbers(array('separator' => '','currentTag' => 'a', 'currentClass' => 'active','tag' => 'li','first' => 1));
                            echo $this->Paginator->next(__('next'), array('tag' => 'li','currentClass' => 'disabled'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
                        ?>
                    </ul>

I am use :

CakePHP 2.5 and Bootstrap 3.0.3

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.