Created
August 11, 2020 03:57
-
-
Save AlifArnado/2100cad97a89f4cf20538fc61ec3681f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$query = "SELECT * FROM Tbl_Seksi";// Query untuk menampilkan semua data siswa | |
$config['base_url'] = base_url('admin_promo/slide/'); | |
$config['total_rows'] = $this->db->query($query)->num_rows(); | |
$config['per_page'] = 3; | |
$config['uri_segment'] = 3; | |
$config['num_links'] = 3; | |
$config['use_page_numbers'] = TRUE; | |
// Style Pagination | |
$config['first_link'] = 'First'; | |
$config['last_link'] = 'Last'; | |
$config['next_link'] = 'Next'; | |
$config['prev_link'] = 'Prev'; | |
$config['full_tag_open'] = '<div class="pagging text-center"><nav><ul class="pagination justify-content-center">'; | |
$config['full_tag_close'] = '</ul></nav></div>'; | |
$config['num_tag_open'] = '<li class="page-item"><span class="page-link">'; | |
$config['num_tag_close'] = '</span></li>'; | |
$config['cur_tag_open'] = '<li class="page-item active"><span class="page-link">'; | |
$config['cur_tag_close'] = '<span class="sr-only">(current)</span></span></li>'; | |
$config['next_tag_open'] = '<li class="page-item"><span class="page-link">'; | |
$config['next_tagl_close'] = '<span aria-hidden="true">»</span></span></li>'; | |
$config['prev_tag_open'] = '<li class="page-item"><span class="page-link">'; | |
$config['prev_tagl_close'] = '</span>Next</li>'; | |
$config['first_tag_open'] = '<li class="page-item"><span class="page-link">'; | |
$config['first_tagl_close'] = '</span></li>'; | |
$config['last_tag_open'] = '<li class="page-item"><span class="page-link">'; | |
$config['last_tagl_close'] = '</span></li>'; | |
// End style pagination | |
$this->pagination->initialize($config); // Set konfigurasi paginationnya | |
if ($this->uri->segment(3) > 0) { | |
$page = $this->uri->segment(3) * $config['per_page'] - $config['per_page']; | |
} else { | |
$page = $this->uri->segment(3) * $config['per_page']; | |
} | |
// $page = ($this->uri->segment($config['uri_segment'])) ? $this->uri->segment($config['uri_segment']) : 0; | |
$query .= " ORDER BY kode OFFSET ".$page." ROWS FETCH NEXT ".$config['per_page']." ROWS ONLY"; | |
$data['limit'] = $config['per_page']; | |
$data['total_rows'] = $config['total_rows']; | |
$data['pagination'] = $this->pagination->create_links(); // Generate link pagination nya sesuai config diatas | |
// echo($data['pagination']); | |
$data['data_view'] = $this->db->query($query)->result(); | |
echo '<pre>'; | |
// print_r($this->uri->segment(3)); | |
print_r($query); | |
echo '<br>'; | |
// print_r($page); | |
// echo '<br>'; | |
// print_r($config['per_page']); | |
// print_r(($this->uri->segment($config['uri_segment'])) ? $this->uri->segment($config['uri_segment']) : 0); | |
// print_r($this->db->query($query)->result()); | |
// print_r($page); | |
print_r($data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment