嗨,我只想問關於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">></a>
我想補充「pendingpost」分頁例子的段之前添加文本「http://localhost/istay/post/5」之前的「5」,所以它將有一個結果「http://localhost/istay/post/pendingpost/5」
我搜索一下,我發現「config ['first_url']」但我不完全理解它,我認爲它只會修改鏈接的第一個網址。我希望有人能幫幫忙。謝謝。
你可以用'的preg_replace()'。 – Yash