如何在编码点火器的单个函数中运行多个分页



我的视图中有两个选项卡。在第一个选项卡上有不同的分页 在第二个选项卡上,我需要使用 CI 分页库运行单独的分页。我无法使用 CI 库运行多个分页实例。

public function index()
{
$total_rows=$this->caste_model->count_caste_list();
//pagination
$start = ($this->uri->segment(3)?$this->uri->segment(3):0); //start 
$per_page=2;
$this->load->library('pagination');
$this->config->load('pagination2', TRUE);

$config                 =   $this->config->item('pagination2'); 
$config['uri_segment']  =   3;  //uri segment

$config['base_url']     =   site_url("caste/index");
$config['total_rows']   =   $total_rows;
$config['per_page']     =   $per_page;
$config['use_page_numbers'] = TRUE;

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

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

$data['castes']=$this->caste_model->caste_list($per_page,$start);
$data['religions']=$this->caste_model->religion_list();
$this->layout('settings/caste&religion/add',$data); 
}

在 CodeIgniter 中,不能在一个视图中运行两个分页。因为它处理URL,一旦第一个分页导航,那么第二个分页(同一页面的底部)也将根据该分页进行响应。

为避免这种情况,请使用引导 3 个数据表进行一次分页。(用于重量轻的部分以快速装载现场。

最新更新