CodeIgniter Forums
Pagination - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Pagination (/showthread.php?tid=65000)



Pagination - davy_yg - 04-19-2016

« First  < 1 2 3 4 5 >  Last »


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

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

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

echo 
$this->pagination->create_links(); 


Can anyone help me explain how to create paging with CI 3 ?

What is ?

PHP Code:
$config['total_rows'] = 200;
$config['per_page'] = 20

what is 20 ?

and what is 200 ?

Thanks in advance.


RE: Pagination - InsiteFX - 04-19-2016

Read the CI Documentation on the Pagination Library, it's right there on top.

Pagination Library


RE: Pagination - davy_yg - 04-19-2016

total_rows This number represents the total rows in the result set you are creating pagination for. Typically this number will be the total rows that your database query returned.

I do not understand what's the purpose for?

$config['total_rows'] = 200;

I do not understand what is the total rows your database query returned?  and what's the difference between:

$config['total_rows'] = 200;

               and

$config['per_page'] = 20;


Thanks.  notes:  I already read the manual and still do not understand it.