Welcome Guest, Not a member yet? Register   Sign In
Pagination 404 error because of &per;_page
#1

[eluser]alphabase[/eluser]
Hi,

I've upgraded a site (which was not designed by me) from 1.7 to the latest version of CI.
But the pagination doesn't work, the generated links look like this:

http://example.com/controller/show_all_t...per_page=2

Here's my code:
Code:
function show_all_top_five($offset=0)
    {
        $data['tab'] = 2;
        $config['base_url'] = BASE.'topfive/show_all_top_five';
        $config['total_rows'] = $this->mtopfive->showAllTopFive($offset,0);
        $config['per_page'] = '2';

        $data['total_page']    = ceil($config['total_rows'] / $config['per_page']);
        $data['current_page']  = (ceil($offset/2)+1);        

        $config['num_links']    = 10;        
        $config['prev_link']   = '< Previous';
        $config['next_link']   = '- Next >';
        $config['num_tag_open'] = ' - ';
        if($data['current_page']>1)
            $config['cur_tag_open'] = ' - ';
        
        $this->load->library('pagination');
        $this->pagination->initialize($config);
        $data['link'] = $this->pagination->create_links();
        $data['top_five']= $this->mtopfive->showAllTopFive($offset,2);
        $this->session->set_userdata('redirect','topfive/show_all_top_five/'.$offset);    
        $this->load->view('vheader',$data);
        $this->load->view('vshowtopfive', $data);
        $this->load->view('vfooter');
    }

Could someone point me where it's going wrong?

Thanks!

Gerard
#2

[eluser]alphabase[/eluser]
I've just tried:

Code:
$config['page_query_string'] = false;

But that doesn't work.
#3

[eluser]alphabase[/eluser]
*bump*
anyone?




Theme © iAndrew 2016 - Forum software by © MyBB