[eluser]Corey Freeman[/eluser]
I'm trying to paginate results from the index function of the controller, instead of from a sub function. However, I get a 404 error whenever I click the "next page" links. Help?
Code:
<?php
class Comic extends CI_Controller {
public function index()
{
$this->load->library('pagination');
$this->load->view('header');
$this->load->model('comics');
$per_page = 1;
$total = $this->comics->count_comics();
$data['comics'] = $this->comics->get_comics($per_page, $this->uri->segment(2));
$base_url = base_url().'comic/';
$config['base_url'] = $base_url;
$config['total_rows'] = $total;
$config['display_pages'] = FALSE;
$config['per_page'] = $per_page;
$config['uri_segment'] = '2';
$this->pagination->initialize($config);
$this->load->view('comic', $data);
$this->load->view('footer');
}
}