Codeigniter分页我正在使用datamodel。我有5020条记录。当我打开页面加载所有记录时,只发生了分页。因此加载需要很长时间。当我打开直接显示在分页中的页面时,我需要。我试过很多方法,没有人能适合我
答案 0 :(得分: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