Codeigniter分页在页面中间有页码(Codeigniter Pagination having page number in the middle of url)

编程入门 行业动态 更新时间:2024-10-26 18:19:11
Codeigniter分页在页面中间有页码(Codeigniter Pagination having page number in the middle of url)

我试图在codeigniter中使用分页类,我的url看起来像这样:

blah.com/posts/browse/page/1/item_per_page/10

无论如何,保持在中间的网页号码?

谢谢

编辑:

$this->load->library('pagination'); $uri = $this->uri->uri_to_assoc(); $page = null; $item_per_page = null; if (count($uri)) { foreach ($uri as $key => $value) { $$key = $value; } } $config['base_url'] = base_url('posts/browse/page//item_per_page/1'); $config['uri_segment'] = 4; $config['per_page'] = '1';

I'm trying to use pagination class in codeigniter and my url looks something like this:

blah.com/posts/browse/page/1/item_per_page/10

is there anyway to keep the page number in the middle of url?

Thanks

EDIT:

$this->load->library('pagination'); $uri = $this->uri->uri_to_assoc(); $page = null; $item_per_page = null; if (count($uri)) { foreach ($uri as $key => $value) { $$key = $value; } } $config['base_url'] = base_url('posts/browse/page//item_per_page/1'); $config['uri_segment'] = 4; $config['per_page'] = '1';

最满意答案

在深入了解分页代码之后,我找到了一种方法来做到这一点,但在教程的任何地方都没有提及。

$config['base_url'] = base_url('posts/browse'); $config['prefix'] = '/page/'; $config['suffix'] = '/item_per_page/1'; $config['uri_segment'] = 4;

这可以生成网址中间的页码。

eg. http://www.blah.com/posts/browse/page/2/item_per_page/1;

After digging through code of Pagination class, I found a way to do this, but it wasn't mentioned anywhere in the tutorial.

$config['base_url'] = base_url('posts/browse'); $config['prefix'] = '/page/'; $config['suffix'] = '/item_per_page/1'; $config['uri_segment'] = 4;

this can generate urls with page number in the middle of the url.

eg. http://www.blah.com/posts/browse/page/2/item_per_page/1;

更多推荐

本文发布于:2023-04-29 07:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335268.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   页码   页面   Codeigniter   Pagination

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!