Welcome Guest, Not a member yet? Register   Sign In
Pagination class won't work for me.
#1

[eluser]Unknown[/eluser]
I'm having some troubles with the pagination class. I've scoured the tutorials both on and off CodeIgniter.com and I just can't get it to work as intended.

The pagination links themselves are showing up just fine, the problem is that there doesnt appear to be any support for the 'current page'.

For example, on my index page I have '1 2 3 > Last >' -- 1 is not a link, it is my current page. 2 and 3 are clickable. When I click them, they work, the content is correct and the correct page is displayed, BUT the pagination code remains the same; '1 2 3 > Last >' with 1 not a link despite the fact I'm on page 2 or 3.

Here is my code:

Code:
function browse($offset)
    {
        $data['images'] = $this->Imagemodel->getTopImages($offset,16);

        $config['base_url'] = '/browse/';
        $config['total_rows'] = $this->db->count_all('images');
        $config['per_page'] = '16';
        
        $this->load->library('pagination');
        $this->pagination->initialize($config);
        
        $data['pagination'] = $this->pagination->create_links();
        
        $this->load->view('header');
        $this->load->view('browse', $data);
        $this->load->view('footer');
    }

What am I doing wrong here?
#2

[eluser]fatnic[/eluser]
You'll probably need to set
Code:
$config['uri_segment']
to the correct segment.
#3

[eluser]Unknown[/eluser]
.. Yep. That was it.

Embarassing! Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB