Co-paging using the semantic interface
I use the following code for pagination:
$config['full_tag_open'] = "<div class='ui right floated pagination menu'>";
$config['full_tag_close'] ="</div>";
$config['num_tag_open'] = '<a class="item">';
$config['num_tag_close'] = '</a>';
$config['cur_tag_open'] = '<a class="item">';
$config['cur_tag_close'] = "</a>";
$config['next_tag_open'] = '<a class="item">';
$config['next_tagl_close'] = "</a>";
$config['prev_tag_open'] = '<a class="item">';
$config['prev_tagl_close'] = "</a>";
$config['first_tag_open'] = '<a class="item">';
$config['first_tagl_close'] = "</a>";
$config['last_tag_open'] = '<a class="item">';
$config['last_tagl_close'] = "</a>";
Part of the design does not work. How to use semantic ui
Use this:
$config['full_tag_open'] = '<div class="ui pagination menu">';
$config['full_tag_close'] ='</div>';
$config['num_tag_open'] = '<li class="item">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active item">';
$config['cur_tag_close'] = '</li>';
$config['next_tag_open'] = '<li class="item">';
$config['next_tagl_close'] = '</li>';
$config['prev_tag_open'] = '<li class="item">';
$config['prev_tagl_close'] = '</li>';
$config['first_tag_open'] = '<li class="item">';
$config['first_tagl_close'] = '</li>';
$config['last_tag_open'] = '<li class="item">';
$config['last_tagl_close'] = '</li>';
create pagination.php file name in config
and call it from the controller or model
include APPPATH.'config/pagination.php';
when you are going to transfer this configuration file, and below is the full code:
$config = array();
$config["base_url"] = base_url() . 'brands/index';
$config["total_rows"] = $this->brand->brand_count();
include APPPATH.'config/pagination.php';
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["results"] = $this->brand->
get_brands($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$this->load->view('brand/view',$data);
$config['full_tag_open'] = '<div class="ui pagination menu">';
$config['full_tag_close'] ='</div>';
$config['num_tag_open'] = '<a class="item">';
$config['num_tag_close'] = '</a>';
$config['cur_tag_open'] = '<a class="active item">';
$config['cur_tag_close'] = '</a>';
$config['next_tag_open'] = '<a class="item">';
$config['next_tagl_close'] = '</a>';
$config['prev_tag_open'] = '<a class="item">';
$config['prev_tagl_close'] = '</a>';
$config['first_tag_open'] = '<a class="item">';
$config['first_tagl_close'] = '</a>';
$config['last_tag_open'] = '<a class="item">';
$config['last_tagl_close'] = '</a>';
Bootstrap v4.0 Codeigniter v3
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] ='</ul>';
$config['num_tag_open'] = '<li class="page-item">';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="page-item active"><a class="page-link" href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['next_tag_open'] = '<li class="page-item"><a href="#" aria-label="Next">';
$config['next_tagl_close'] = '</a></li>';
$config['prev_tag_open'] = '<li class="page-item">';
$config['prev_tagl_close'] = '</li>';
$config['first_tag_open'] = '<li class="page-item disabled">';
$config['first_tagl_close'] = '</li>';
$config['last_tag_open'] = '<li class="page-item"><a href="#" aria-label="Next">';
$config['last_tagl_close'] = '</a></li>';
$config['attributes'] = array('class' => 'page-link');