Welcome Guest, Not a member yet? Register   Sign In
Pagination Problem
#1

[eluser]Unknown[/eluser]
I'm having a small problem with the pagination class.

I have 14 records in a table, and I want 6 shown at a time. Here's the code:

Code:
...
$this->load->library('pagination');

$config['base_url'] = base_url().'gallery/main';
$config['total_rows'] = $this->db->count_all('gallery_images');
$config['per_page'] = 6;
$config['uri_segment'] = 3;
        
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();

$this->load->model('gallery_model');
$data['results'] = $this->gallery_model->get_images($config['per_page'], $this->uri->segment(3));
...

Now, for some reason, the pages links echo'd in the view all have an offset the same as the per_page config var.

Code:
&nbsp;<b>1</b>&nbsp;<a href="/gallery/main/6">2</a>&nbsp;<a href="/gallery/main/12">3</a>&nbsp;<a href="/gallery/main/6">&gt;</a>&nbsp;

Shouldn't the offset be one more than the page number, for example the page 2 link goes to gallery/main/1 and not 6?

Thanks.


Messages In This Thread
Pagination Problem - by El Forum - 09-28-2008, 08:23 AM
Pagination Problem - by El Forum - 09-28-2008, 09:28 AM
Pagination Problem - by El Forum - 09-28-2008, 09:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB