CodeIgniter Pagination example using Version 2.0.2

Pagination using CodeIgniter is very easy to implement . Lets see an example with code segment .This code should be placed at Controller of CodeIgniter application folder :


class Controller_name extends CI_Controller{
 public function  __construct() {
 public function index(){
  $basurl = base_url().'index.php/product/index';
  $config['base_url'] = $basurl;
  $config['total_rows'] = $this->db->get('products')->num_rows();
  $config['per_page'] = 10;
  $config['full_tag_open'] = '<p id="pagination" style="float: right;width:20%">';

  $config['full_tag_close'] = '</p>';

  $res = $this->db->get('products', $config['per_page'], $this->uri->segment(3));
  $data['products'] = $res->result();

  $data['page'] = 'product';


At CodeIgniter View >> layout ( i used this name at controller see before ) you should just Paste this code to see pagination link:


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


You can change outlook of pagination tag.Here is some css code:

#pagination a{
#pagination a:hover{

#pagination strong{

3 responses to “CodeIgniter Pagination example using Version 2.0.2

  1. Do you mind if I quote a couple of your articles as long as I provide credit and sources back to your website?

    My blog is in the very same niche as yours and my users would truly benefit from some of
    the information you present here. Please let me know if this is alright with you.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s