我正在使用CI3,并且第二页上的分页不起作用。我错过了什么吗?这是我的控制器代码:
public function tags($task = "list")
{
$header['title'] = 'Tag List';
$this->load->view("template/header", $header);
$this->load->view("template/dashboardNavView");
$builder ['task'] = $task;
if($task == "list" || $task == "")
{
$pager['base_url'] = "/dashboard/tags/";
$pager['total_rows'] = $this->db->count_all('tags');
$pager['per_page'] = 4;
$pager["uri_segment"] = 3;
$this->pagination->initialize($pager);
$page = $this->uri->segment(3);
$builder['tags'] = $this->db->order_by('id', 'DESC')->limit($pager['per_page'], $page)->get('tags')->result();
$builder['pager'] = $this->pagination->create_links();
}
$this->load->view("tags/TagsBuilderView", $builder);
$this->load->view("template/footer");
}
一切似乎都没问题,但是当我点击第二个链接时,会返回空视图。
答案 0 :(得分:0)
解决方案是将所有内容用于控制器内的新方法“list_tags()”。