2013-03-04 46 views
4

CI多个分页我尝试在同一视图中使用多个分页的笨。 我CONTROLER是:在第一和第二配置,独立在一个视图中,

public function gallery() 
{ 

    $config1 = array(); 
    $config1["base_url"] = site_url("pages/gallery"); 
    $config1["total_rows"] = $this->pagination_model->video_count(); 
    $config1["per_page"] = 1; 
    $config1["uri_segment"] = 3; 

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

    $page1 = ($this->uri->segment(3,0)) ? $this->uri->segment(3,0) : 0; 
    $data["videos"] = $this->pagination_model->fetch_video($config1["per_page"], $page); 
    $data["links1"] = $this->pagination->create_links(); 

    $config2 = array(); 
    $config2["base_url"] = site_url("pages/gallery").'/'.$this->uri->segment(3,0); 
    $config2["total_rows"] = $this->pagination_model->gallery_count(); 
    $config2["per_page"] = 3; 
    $config2["uri_segment"] = 4; 

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

    $page2 = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0; 
    $data["galleries"] = $this->pagination_model->fetch_gallery($config2["per_page"], $page2); 
    $data["links2"] = $this->pagination->create_links(); 

    $this->template->gallery_view($data); 
} 

分页工作正常,但是当我点击页面NR。 3为前。在分页链接2上的分页链接1上转到nr。 3(仅页面编号内容正常)和第6页link1,但链接2增加+1。

需要对按点击链接1:

  • 链接1 ------------链接2

    1 ---- curent_page_link2(默认为链接2 = '' )

    2 ---- curent_page_link2

    3 ---- curent_page_link2

    3 ---- curent_page _link2

但我对按点击链接1:

  • 链接1 ----------链接2

    1 ---- curent_page_link2(默认为链接2 = '')

    2 ---- curent_page_link2(默认为LINK2 = '')

    3 ---- curent_page_link2 (需要是(默认为LINK2 = ''),但我有ACTIV LINK2 = '' 2 '从LINK2 =内容')

    4 ---- curent_page_link2

    5 ---- curent_page_link2 (需要先(默认为链接2 = ''),但我有ACTIV链接2 = '3'链接2 =内容')

对不起,我的英语水平。

回答

1

我没有测试过这一点。这可能会帮助你。在config1中使用'前缀'和'后缀'作为分页。

... 

$config1 = array(); 
$config1["base_url"] = site_url("pages/gallery"); 
$config1["total_rows"] = $this->pagination_model->video_count(); 
$config1["per_page"] = 1; 
$config1["uri_segment"] = 3; 

//////////////////////////////////////////////////////// 

$config1['prefix'] = ''; 
$config1['suffix'] = '/'.$this->uri->segment(4,0); 

//////////////////////////////////////////////////////// 

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

... 
+1

嗨阿琼拉吉。感谢您的解决方案。我尝试类似的东西,但我有错误点击第一个链接。我想我只有一个解决方案,用AJAX来做。 – 2013-03-07 14:21:27

相关问题