codeigniter pagging


/ Published in: PHP
Save to your folder(s)

make pagination for dataview in model


Copy this code and paste it in your HTML
  1. function get_data_eJIC_page($start=0, $per_page=0){
  2. //pagination
  3. $config['base_url'] = base_url().'index.php/digital/index';
  4. $config['total_rows'] = $this->db->get('konver')->num_rows();
  5. $config['per_page'] = $per_page;
  6. $config['full_tag_open'] = '<ul class="pagination">';
  7. $config['full_tag_close'] = '</ul>';
  8. $config['num_links'] = 10;
  9. $config['first_link'] = 'Awal';
  10. $config['last_link'] = 'Akhir';
  11. $config['first_tag_open'] = '<li>';
  12. $config['first_tag_close'] = '</li>';
  13. $config['last_tag_open'] = '<li>';
  14. $config['last_tag_close'] = '</li>';
  15. $config['next_tag_open'] = '<li>';
  16. $config['next_tag_close'] = '</li>';
  17. $config['prev_tag_open'] = '<li>';
  18. $config['prev_tag_close'] = '</li>';
  19. $config['num_tag_open'] = '<li>';
  20. $config['num_tag_close'] = '</li>';
  21. $this->pagination->initialize($config);
  22. //end
  23.  
  24. if($per_page > 0){
  25. $this->db->from('konver');
  26. $this->db->limit($per_page, $start);
  27. $data = $this->db->get();
  28. }else{
  29. $data = $this->db->get('konver');
  30. }
  31.  
  32. return $data;
  33. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.