2016-02-17 30 views
1

嗨,我只想問關於codeigniter分頁鏈接。在codeigniter的分頁鏈接段之前添加文本

這是我的控制器:

$configp['base_url'] = base_url().'post'; 
    $configp['total_rows'] = $this->db->where('status',0)->get('room_post')->num_rows(); 
    $configp['per_page'] =5; 
    $configp['uri_segment'] = 2; 

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

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

我想如果我創建這個鏈接就會產生此鏈接

<strong>1</strong> 
<a href="http://localhost/istay/post/5" data-ci-pagination-page="2">2</a> 
<a href="http://localhost/istay/post/5" data-ci-pagination-page="2" rel="next">&gt;</a> 

我想補充「pendingpost」分頁例子的段之前添加文本「http://localhost/istay/post/5」之前的「5」,所以它將有一個結果「http://localhost/istay/post/pendingpost/5

我搜索一下,我發現「config ['first_url']」但我不完全理解它,我認爲它只會修改鏈接的第一個網址。我希望有人能幫幫忙。謝謝。

+0

你可以用'的preg_replace()'。 – Yash

回答

0

$configp['base_url'] = base_url().'post'; 

變化

$configp['base_url'] = base_url().'post/pendingpost'; 
+0

希望你明白....... Reyver Cris –

+0

哈哈我沒有意識到這一點。哈哈謝謝你的答案。 :) –