Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2.  
  3. class page extends CI_Controller {
  4.     protected $href = '';
  5.     //put your code here
  6.     public function __construct()
  7.     {
  8.         parent::__construct();
  9.         $this->load->library(array('pagination','links'));
  10.        
  11.         $this->href = array(
  12.             'form' => $this->links->get_link().'/form',
  13.             'refresh' => $this->links->get_link(),
  14.             'batal' => $this->links->get_link(),
  15.         );
  16.     }    
  17.    
  18.     public function halaman() {
  19.         $this->index();
  20.     }
  21.    
  22.     public function index() {          
  23.         $this->load->model('pagination/data');
  24.         $hal = number_format((float)$this->uri->segment(3));
  25.         $per_page = 5;
  26.        
  27.         $pcfg = array(
  28.             'base_url' => $this->links->get_link() . '/page/halaman/',
  29.             'per_page' => $per_page,
  30.             'total_rows' => $this->data->all_data(),
  31.             'attributes' => array('class' => 'btn btn-default'),
  32.             'full_tag_open' => '<div class="btn-group">',
  33.             'full_tag_close' => '</div>',
  34.             'cur_tag_open' => '<button type="button" class="btn btn-danger">',
  35.             'cur_tag_close' => '</button>',
  36.             'first_link' => 'Awal',
  37.             'last_link' => 'Akhir',
  38.         );
  39.        
  40.         $this->pagination->initialize($pcfg);
  41.  
  42.         $res = array(
  43.             'list' => $this->data->data_pengguna($per_page,$hal),
  44.             'jmldata' => $pcfg['total_rows'],
  45.             'link' => $this->pagination->create_links(),
  46.         );
  47.        
  48.         $this->load->view('pagination/view_page',$res);
  49.     }
  50. }
  51.  
  52.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement