CodeIgniter Forums
paginations links - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: paginations links (/showthread.php?tid=7155)



paginations links - El Forum - 03-27-2008

[eluser]edhrx[/eluser]
Hi,
I am having a problem with paginations links. It only ever displays 1,2,3 >last even though there are loads more pages. The clicks on 1,2 or 3 all work as expected but there is no displaying of 4,5,6 etc

Best wishes Ed.


paginations links - El Forum - 03-27-2008

[eluser]Merolen[/eluser]
Code:
$config['total_rows'] = 30;

My first guess would be that the total_rows isn't getting the right number. Have you checked that?

Have you gone through the pagination documentation?


paginations links - El Forum - 03-27-2008

[eluser]Seppo[/eluser]
My first guess is $config['num_links'] = 2;
Quote: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, as in the example links at the very top of this page.
http://ellislab.com/codeigniter/user-guide/libraries/pagination.html


paginations links - El Forum - 03-27-2008

[eluser]edhrx[/eluser]
Seppo,
many thanks , you were right the ['num_links'] was not set. However, the issue is still not fully resolved. I use pagination in one or two of the sites no problem...however, if you say click on on link '16' then next return from the server should give something like
15, 16, 17 18 last etc. it remains on 16

thanks ed


paginations links - El Forum - 03-27-2008

[eluser]Merolen[/eluser]
Both num_links and per_page has a default value if you don't specify it, so can't understand why that should have anything to do with it.
Code:
$config[’num_links’] = 2;
$config[’per_page’] = 10

This is my pagination helperfuntion which works fine

Code:
function pagination($url, $numRows) {
    $CI =& get_instance();
    
    $CI->load->library('pagination');
    
    $config['base_url'] = site_url().'/'.$url;
    $config['total_rows'] = $numRows;
    $config['per_page'] = 15;
    $config['first_link'] = '';
    $config['last_link'] = '';
    $config['num_links'] = 5;
    $CI->pagination->initialize($config);
    $pagStr = $CI->pagination->create_links();
    
    return $pagStr;
}