Skip to content

Instantly share code, notes, and snippets.

@vc7
Last active December 19, 2015 15:29
Show Gist options
  • Select an option

  • Save vc7/5976694 to your computer and use it in GitHub Desktop.

Select an option

Save vc7/5976694 to your computer and use it in GitHub Desktop.
Bootstrap has its owned format of pagination, this gist is the configure to make pagination in Codeigniter matching with Bootstrap.
$this->load->library('pagination');
// Config Pagination
$config = array(
'base_url' => base_url(),
'total_rows' => 100,
'per_page' => 10,
'full_tag_open' => '<div class="pagination pagination-centered"><ul>',
'full_tag_close' => '</ul></div>',
'first_link' => $this->lang->line('First'),
'first_tag_open' => '<li>',
'first_tag_close' =>'</li>',
'last_link' => $this->lang->line('Last'),
'last_tag_open' => '<li>',
'last_tag_close' => '</li>',
'prev_link' => $this->lang->line('Previous'),
'prev_tag_open' => '<li>',
'prev_tag_close' => '</li>',
'next_link' => $this->lang->line('Next'),
'next_tag_open' => '<li>',
'next_tag_close' => '</li>',
'cur_tag_open' => '<li class="active"><a>',
'cur_tag_close' => '</a></li>',
'num_tag_open' => '<li>',
'num_tag_close' => '</li>'
);
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment