【问题标题】:Adding Text before pagination link segment of codeigniter在codeigniter的分页链接段之前添加文本
【发布时间】:2016-05-28 15:16:05
【问题描述】:

嗨,我只是想问一下关于 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>

我想在“http://localhost/istay/post/5”的“5”之前添加“pendingpost”,这样结果就会是“http://localhost/istay/post/pendingpost/5

我搜索了一下,发现了“config['first_url']”,但我并不完全理解它,我认为它只会修改链接的第一个 url。我希望有人能帮帮忙。谢谢。

【问题讨论】:

  • 你可以使用preg_replace()

标签: codeigniter pagination uri segments


【解决方案1】:

改变

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

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

【讨论】:

  • 哈哈我没有意识到这一点。哈哈谢谢你的回答。 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-05
  • 1970-01-01
相关资源
最近更新 更多