Codeigniter 代码点火器分页不工作
我设置了CodeIgniter分页的属性,但是我得到了一个错误Codeigniter 代码点火器分页不工作,codeigniter,pagination,Codeigniter,Pagination,我设置了CodeIgniter分页的属性,但是我得到了一个错误 1 2 3 4 5 > 我的分页工作在第2-5页,第1页除外。我不知道为什么会这样。这是我的控制器函数,其中控制器名称为c\u论坛 function show_posts_by_chapter($id_chapter=false) { if($id_chapter==false) show_404(); $config = array(); $config["base_url"]
1 2 3 4 5 >
我的分页工作在第2-5页,第1页除外。我不知道为什么会这样。这是我的控制器函数,其中控制器名称为c\u论坛
function show_posts_by_chapter($id_chapter=false) {
if($id_chapter==false)
show_404();
$config = array();
$config["base_url"] = base_url() . "index.php/c_forum/show_posts_by_chapter/" . $id_chapter.'/';
$config['total_rows'] = $this->m_forum->num_rows_by_chapter($id_chapter);
$config['per_page'] = 2;
$configp['uri_segment'] = 4;
$choice = $config["total_rows"] / $config["per_page"];
$config["num_links"] = round($choice);
$this->pagination->initialize($config);
$page = ($this->uri->segment(4)) ? $this->uri->segment(4) : 0;
$data['chapter_id'] = $id_chapter;
$data['allowed'] = $this->_get_level();
$data['count_rows'] = $config['total_rows'];
$data['posts_all'] = $this->m_forum->get_posts_by_chapter($config['per_page'], $page, $id_chapter);
$data['links'] = $this->pagination->create_links();
$this->load->view('forum/show_posts', $data);
}
视图很简单:
`<?php echo $links; ?>`
``
我使用了
$configp['uri\u segment']=4代码>并且它应该是$config['uri_segment']=4代码>$configp['uri_segment']=4
这应该是
$config['uri_segment']=4
你所说的“1下无下划线”是什么意思?我想上传一张图片,这样你就可以很容易地得到它。但这里有新内容。但主题是,如果我在5后点击next,我得到的是2而不是1。可能是$config[“num\u links”]
,如果删除它会发生什么?删除$config[“num\u links”]后的结果相同,现在得到的是1 2 3>而不是上一个,但仍然没有得到1。