2016-05-11 11 views
0

Codeigniterページング私はデータモデルを使用しています。私は5020のレコードを持っています。ページを開くと、すべてのレコードがロードされ、ページネーションのみが発生しました。だから、ロードに時間がかかります。私はページを直接ページネーションで表示する必要があります。私は誰も私に適した方法をたくさん試してみたCodeigniterデータモデルを使用したページ番号

+0

ようこそ私には適しています。これまでに試したコードを共有してください。 http://stackoverflow.com/help/how-to-askを参照してください – Daenarys

+0

ページネーションのページングをお試しください[ここをクリック](http://stackoverflow.com/questions/36912816/codeigniter-active-records-query-taking-tooデータベースからの負荷時間データ/ 36914711#36914711)。 –

答えて

0
 You need to load pagination library :- 



$this->load->library('pagination'); 

     Than you need to set the values according to your choice 



$config['per_page']= 10; 
      $config['uri_segment'] = 4; 
      $config['base_url'] = site_url('on which page you want to put the pagination').'/'; 
       $this->data['per_page_display'] = $config['per_page']; 
       $config['total_rows'] = count('Get total records from your model'); 

       $this->data['totalcount'] = $config['total_rows']; 


      $this->pagination->initialize($config); 


      $this->data['paginglinks'] = $this->pagination->create_links(); 


      $this->data['per_page'] = $this->uri->segment(4); 
      $this->data['page'] = $offset; 


     Than you can use your pagination on your view 
関連する問題