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/10is 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;更多推荐
发布评论