/ Published in: PHP
make pagination for dataview in model
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function get_data_eJIC_page($start=0, $per_page=0){ //pagination $config['base_url'] = base_url().'index.php/digital/index'; $config['total_rows'] = $this->db->get('konver')->num_rows(); $config['per_page'] = $per_page; $config['full_tag_open'] = '<ul class="pagination">'; $config['full_tag_close'] = '</ul>'; $config['num_links'] = 10; $config['first_link'] = 'Awal'; $config['last_link'] = 'Akhir'; $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['last_tag_open'] = '<li>'; $config['last_tag_close'] = '</li>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); //end if($per_page > 0){ $this->db->from('konver'); $this->db->limit($per_page, $start); $data = $this->db->get(); }else{ $data = $this->db->get('konver'); } return $data; }