Welcome Guest, Not a member yet? Register   Sign In
How to make paging from the basics
#15

Everything works, the only thing I can not fix is the url, in fact every page is shown as: mysite.com/per_page?=5
I could not do something like mysite.com/page/2

Il mio controller

PHP Code:
   public function index() {
 
       $offset 0;
 
       if ($this->input->get('per_page') != null) {
 
           $offset $this->input->get('per_page');
 
       }
 
       
        $count 
5//number of posts in page 
 
       $filter = array();
 
       $data['post_count'] = $this->post_model->get_active_posts($filter);
 
       $data['title'] = 'Title';
 
       $data['desc'] = 'Enter the description of this page index';
 
       $data['post'] = $this->post_model->get_index($filter$count$offset); 
 
       $config['base_url'] = base_url();
 
       $config['total_rows'] = $data['post_count'];
 
       $config['per_page'] = $count;
 
       $config['next_link'] = "next →";
 
       $config['prev_link'] = "← previous";
 
       $this->pagination->initialize($config);
 
       $data['pagination'] = $this->pagination->create_links();
 
       
        $this
->load->view('templates/header'$data);
 
       $this->load->view('index'$data);
 
     
Reply


Messages In This Thread
RE: How to make paging from the basics - by Marcolino92 - 08-21-2017, 12:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB