// ----------------------------------------------------------------------------------------------//
RSS

Codeigniter Paginaton With Bootstrap css

Bootstrap Paginaton With Codeigniter

Bootstrap Paginaton With Codeigniter
Controller Code:::

Load Pagination library in your controler:

$this->load->library('pagination');


Code::-- public function view() {
// $data['result']=$this->nj_user->getallUser();
$this->load->view('layout/header');
$this->load->view('layout/sidebar');
//Pagination
$config = array();
$config['base_url'] = $this->config->base_url() . 'user/view';
$config['total_rows'] = $this->nj_user->count_user();
$config['per_page'] = 7;
$config['uri_segment'] = 3;
$choice = $config['total_rows'] / $config['per_page'];
$config['num_links'] = round($choice);
//config for bootstrap pagination class integration
$config['full_tag_open'] = '<ul class='pagination'>';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = false;
$config['last_link'] = false;
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['prev_link'] = '&laquo';
$config['prev_tag_open'] = '<li class='prev'>';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = '&raquo';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class='active'><a href='#'>';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data['result'] = $this->nj_user->getallUser($config['per_page'], $page);
$data['link'] = $this->pagination->create_links();
$this->load->view('user/userview', $data);
$this->load->view('layout/footer');
}
Model code::-
function getallUser($limit = NULL,$start =NULL)
{
$sql='Select

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comments: