CakePHP 2 Slightly Better Looking than Default Pagination

Written by James McDonald

April 18, 2016

Just trying to make my pagination in CakePHP 2 better looking.

I added the first and last links but still had a radius on my previous and next links which looked odd and my ‘last >>’ link had a square end too. So a bit ugly really.

ugly_pagination

Following is an example of pagination links after I have turned off some of the classes on the next previous links to stop them rendering with corner radiuses, added a HTML entity of &rsaquo; and &lsaquo; instead of ‘<‘ and ‘>’ and &laquo; and &raquo; instead of ‘<<‘ and ‘>>’

Looks better.

pagination

 <div class="paging">
        <?php
        echo $this->Paginator->first('&laquo; first', ['escape' => false, 'class' => 'prev']);
        echo $this->Paginator->prev('&lsaquo; ' . __('previous'), array('escape' => false, 'class' => false), null, array('class' => 'prev disabled'));
        echo $this->Paginator->numbers(array('separator' => ''));
        echo $this->Paginator->next(__('next') . ' &rsaquo;', array('escape' => false, 'class' => false), null, array('class' => 'next disabled'));
        echo $this->Paginator->last('last &raquo;', ['escape' => false, 'class' => 'next']);
        ?>
 </div>

0 Comments

Submit a Comment

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

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...