Skip to content

Instantly share code, notes, and snippets.

@stoddsie
Last active December 15, 2015 22:59
Show Gist options
  • Save stoddsie/5336964 to your computer and use it in GitHub Desktop.
Save stoddsie/5336964 to your computer and use it in GitHub Desktop.
Codeigniter:Pagination setup (standard)
//pagination
$this->load->library('pagination');
$per_page = 15;
$config['uri_segment'] = 3;
$config['base_url'] = '/';
$config['anchor_class'] = ' class="pagination" ';
$config['total_rows'] = TOTAL_RECORDS;
$config['per_page'] = $per_page;
$config['use_page_numbers'] = TRUE;
$choice = $config["total_rows"] / $config["per_page"];
$config["num_links"] = round($choice);
$this->pagination->initialize($config);
$page = ($this->uri->segment(3))? $this->uri->segment(3) : 0;
$data['pagination'] = $this->pagination->create_links();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment