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 *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Network speed test host to host

On Ubuntu / Debian apt-get install iperf3 On Windows download it from https://iperf.fr/iperf-download.php#windows Make...

Clear HSTS Settings in CHrome

Open chrome://net-internals/#hsts enter the domain in the query field and click Query to confirm it has HSTS settings...