Welcome Guest, Not a member yet? Register   Sign In
Another pagination problem
#1

[eluser]RobertB.[/eluser]
Hello guys,
I'm lost with pagination.
Code:
$what = $this->input->post('whatId');
            $where = $this->input->post('whereId');
            $r = 3959;
            $d = 20;
            
            if(strlen($what) > 0){
               $this->session->set_userdata('what', $what);
            }
            $what = $this->session->userdata('what');
            
            if(strlen($where) > 0){
               $this->session->set_userdata('where', $where);
            }
            $where = $this->session->userdata('where');
            
            $this->load->model('listings/listings_model', 'listings');
            
            $this->load->library('pagination');

            $config['base_url'] = base_url().'/search/';
            $config['total_rows'] = $this->listings->getSearchCount($what, $where, $r, $d);
            $config['per_page'] = 6;
            $config['num_links'] = 10;
            
            $this->pagination->initialize($config);
            
            $data['entries'] = $this->listings->getSearch($what, $where, $r, $d, $config['per_page'] = 6);
            
            if (!$data['entries']) {
                redirect('');
            } else {

                $data['links'] = $this->pagination->create_links();
                $data['main_content'] = 'listings/entries_view';
                $this->load->view('templates/template', $data);

I think that the config part is working because if I put the per_page any higher than the total of return records the paginations links don't show in the view.
What I'm having problem with is that the right amount of link show but in this case all the records show in the first page.

I don't know if it makes any difference but I'm using routes

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB