2013-03-04 51 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

相關問題