Welcome Guest, Not a member yet? Register   Sign In
Pagination page not found
#1

Hello there,

I am working on platform with codeigniter 2. Using the pignation library but am getting an error saying page not found when 
I click on the next button.
Please help me out.

function in the controller
PHP Code:
 public function allProducts($offset 0)
 
 {
 
     $config['base_url'] = base_url()."Products/allProducts";
 
     $config['total_rows'] = $this->product_model->total_product_count();
 
     $config['per_page'] = "1";
 
     $choice $config["total_rows"] / $config["per_page"];
 
     $config["num_links"] = floor($choice);

 
        //config for bootstrap pagination class integration
 
     $config['full_tag_open'] = '<ul class="pagination">';
 
     $config['full_tag_close'] = '</ul>';
 
     $config['first_link'] = false;
 
     $config['last_link'] = false;
 
     $config['first_tag_open'] = '<li>';
 
     $config['first_tag_close'] = '</li>';
 
     $config['prev_link'] = '&laquo';
 
     $config['prev_tag_open'] = '<li class="prev">';
 
     $config['prev_tag_close'] = '</li>';
 
     $config['next_link'] = '&raquo';
 
     $config['next_tag_open'] = '<li>';
 
     $config['last_tag_open'] = '<li>';
 
     $config['last_tag_close'] = '</li>';
 
     $config['cur_tag_open'] = '<li class="active"><a href="#">';
 
     $config['cur_tag_close'] = '</a></li>';
 
     $config['num_tag_open'] = '<li>';
 
     $config['num_tag_close'] = '</li>';

 
     $this->pagination->initialize($config);
 
     $data['page'] = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;

 
        //call the model function to get the department data
 
     $data['allProducts'] =  $this->product_model->get_Products($config["per_page"], $data['page']);
 
     $data['pagination'] = $this->pagination->create_links();

 
     $data['main_content'] ='allProducts';
 
     $this->load->view('layouts/main'$data);
 
 
function in the model
PHP Code:
 public function get_Products($limit=null,$offset=NULL){
 
   $this->db->select('*');
 
   $this->db->from('products');
 
   $this->db->limit($limit$offset);
 
   $this->db->order_by("id","desc");
 
   return $this->db->get()->result();
 
 }
 
 // Get total product
 
 public function total_product_count(){
 
   return $this->db->count_all("products");
 
 

then in the view I echo this'
PHP Code:
 <div class="row text-center">
 
       <div class="col-md-12">
 
     <div class="row"><?php echo $pagination;?></div>
     </div>
   </div> 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB