CodeIgniter Forums
pagination library hide some links - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: pagination library hide some links (/showthread.php?tid=64998)



pagination library hide some links - insik - 04-18-2016

My codeigniter pagination library is creating the links like this.
If I have 8 pages

1 2 3 4 5 6 7 8 >>

My question is how to hide some links if it is more than 5 links.
like this

1 2 3 4 5 ... >>

Thanks.


RE: pagination library hide some links - Wouter60 - 04-18-2016

Use $config['num_links'] = .. to set the number of “digit” links you would like before and after the selected page number. For example, the number 2 will place two digits on either side.

Example:
PHP Code:
$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200;
$config['per_page'] = 20;
$config['num_links'] = 2;

$this->pagination->initialize($config); 



RE: pagination library hide some links - Bhavesh - 04-19-2016

Hi

You can use
$config[‘num_links’] = 2;

For more help visit below link:
http://www.codeigniter.com/user_guide/libraries/pagination.htm