1
votes

In my Codeigniter project, I am trying to implement Pagination using CI's Pagination library. My Controller function is as shown below :

function uploadhistory()
{
    $data['num']=20;
    $this->load->library('pagination'); // library for pagination
    $config['base_url'] = base_url().'video/uploadhistory/'; 
    $config['total_rows'] = $data['num']; 
    $config['per_page'] = 3; 
    $config['page_query_string'] = TRUE;
    $this->pagination->initialize($config); 
    echo $this->pagination->create_links();

    $data['page']='video/uploadhistory';
    $this->load->view('layout/template',$data);
}

The problem is, pagination URL is coming like:

http://www.domain.com/project/video/uploadhistory/&per_page=3.

What I need is like:

http://www.domain.com/project/video/uploadhistory/3.

I have set $config['enable_query_strings'] = TRUE; in application/config/config.php file.

Can anyone help me to find a solution to this?

Thanks in advance.

1
have you tried setting it to false?, then uploadhistory($page_num = 1)user1978142
Dude when you use link like domain.com/project/video/uploadhistory/3 then it means you are passing param to controller function like function uploadhistory($id) then it will work as you wantedbhushya
$config['page_query_string'] = FALSE; try this after above chnagesbhushya
no any changes still. Now also the link contains & and is giving me page not found error.Jenz

1 Answers

1
votes

Maybe you can try this

$config['page_query_string'] = FALSE;
$config['uri_segment'] = 4;

The main problem here is that the default value of "uri_segment" is 3, which represents the 'uploadhistory" in your URL. You have to force it to 4, so that it takes the correct segment of the URL.

More info on the Codeigniter Pagination Class doc