[eluser]lifewithryan[/eluser]
Hi there, I've searched the forums and can't seem to find anyone whose fought with the same issue as I am currently. I've used pagination before without a problem but I'm currently seeing something strange at the moment.
I'm rebuilding my blog and in there I have an image gallery that I'm trying to paginate, 12 thumbs on each page with pagination links.
The links show up fine but after navigating away from the first page, page number one remains bold and never becomes a link to go back to page number one.
Also the "next group of pages" link seems to always point to the second page....
Quick example:
I have 84+ images, 12 per page. I've left the default 'num_links' alone. CI is creating: 1 2 3 > Last>
Link #1 never becomes an "actual link" just stays bold.
Links #2, & #3 work just fine
Link #4 (the > symbol) is pointing to controller/method/12 instead of the next group of pages, (I assumie it should be /controller/method/(36 + 12) etc)
Link #5 (the "last" link) is pointing correctly to controller/method/84
Anyone else seen this before?
Here's the code that I'm using to build pagination:
controller:
Code:
function show($gal, $offset=0) {
$allImages = $this->gallery->findImagesForGallery($gal, $offset, 0);
$paginatedImages = null;
$paginatedImages = $this->gallery->findImagesForGallery($gal, $offset, 12);
$config['base_url'] = "/gallery/show/$gal/";
$config['total_rows'] = sizeof($allImages);
$config['per_page'] = 12;
$this->pagination->initialize($config);
$myGallery = $this->gallery->findByVal('prettyUrl', $gal);
$data['gallery'] = $myGallery;
$data['pictures'] = $paginatedImages;
$data['pagination'] = $this->pagination->create_links();
$this->load->view('ShowGallery', $data);
}
model:
Code:
function findImagesForGallery($gal, $offset, $limit=12) {
$this->db->select('*');
$this->db->from('images');
$this->db->join('galleries', 'images.galleryId = galleries.id', 'left outer');
$this->db->where('galleries.prettyUrl', $gal);
if($limit > 0) { //pass in 0, i get ALL images for that gallery so I can get total rows
$this->db->limit($limit, $offset);
}
$query = $this->db->get();
return $query->result();
}
Anyone have any ideas? I've tried numerous things, but no dice...