[eluser]OES[/eluser]
Hi Rubiz.
Here is a sample of my code which will hopeully shed some light.
First the controller where I am going to paginate some results.
Code:
function index()
{
$offset = $this->uri->segment(3);
$perpage = 20;
$this->data['results'] = $this->Files_model->search_files('', $perpage,$offset);
// Pagination
$url = $this->config->site_url();
$pagination_config['base_url'] = $url.'admin/files/';
$pagination_config['total_rows'] = count($this->Files_model->list_files());
$pagination_config['per_page'] = $perpage;
$this->pagination->initialize($pagination_config);
$this->data['pagination'] = $this->pagination->create_links();
$this->mysmarty->view('admin/files/welcome', $this->data);
}
And here is a basic model (Files_model) with the function search_files.
Code:
function search_files( $data='', $perpage, $offset='' )
{
$this->db->select('files');
$this->db->limit($perpage, $offset);
$this->db->order_by('date', 'DESC');
$query = $this->db->get('files');
return $query->result_array();
}
This should hopefully get you on the right track.
Bare in mind I am passing everything to the view including the pagnation create links.
Good Luck
Lee