codeigniter pagination model code example
Example 1: pagination in codeigniter with example
$config = array();
$config["base_url"] = base_url() . "index.php/StudentPagination_Controller/index";
$config["total_rows"] = $this->StudentPagination_Model->get_count();
$config["per_page"] = 10;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3))? $this->uri->segment(3) : 0;
$data["links"] = $this->pagination->create_links();
$data['student'] = $this->StudentPagination_Model->get_students($config["per_page"], $page);
$this->load->view('pagination', $data);
Example 2: codeigniter pagination example using ul li in controller
I have tried, This Controller code works fine
$config['full_tag_open'] = "<ul class='pagination'>";
$config['full_tag_close'] = '</ul>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['prev_link'] = '<i class="fa fa-long-arrow-left"></i>Previous Page';
$config['prev_tag_open'] = '<li>';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = 'Next Page<i class="fa fa-long-arrow-right"></i>';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$this->pagination->initialize($config);
In a view part put below code....
<?php echo $this->pagination->create_links(); ?>