我有问题,这是一个有问题的网页签名和路线! 我设置路线我的功能类如下:
$route['admin/panel/students/new-stuedents-list/:num'] = "admin/newStuedentsList/$1";
然后在我的控制器中,我创建了一个调用newStuedentsList
并加载分页库的函数,每个工作正常但分页导航... :(
页面加载成功...
并且数据是正确的...
蝙蝠,当我点击例如第2页,第2页成功加载但分页导航显示页面我butten ... !!!
当我调用第4页表单url(http:// localhost / d / index.php / admin / panel / students / new-stuedents-list / 30)时,数据再次正确...但是分页导航显示第1页butten和页面数量不变!
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/d/index.php/admin/panel/students/new-stuedents-list/';
$config['total_rows'] = $this->db->get('new_contest')->num_rows();
$config['pre_page'] = 10;
$config['num_links'] = 20;
$config['full_tag_open'] = '<div class="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$adminInfo = $this->admin_model->adminInfo();
$newStudentsList['students'] = $this->admin_model->newStudentsList($config['pre_page'],$this->uri->segment(5));
$data = array_merge($adminInfo,$newStudentsList);
$this->load->view('admin/newStudentsList',$data);
但newStuedentsList
为:
$this->load->library('pagination');
$config['base_url'] = 'http://localhost/d/index.php/admin/newStuedentsList/';
$config['total_rows'] = $this->db->get('new_contest')->num_rows();
$config['pre_page'] = 10;
$config['num_links'] = 20;
$config['full_tag_open'] = '<div class="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$adminInfo = $this->admin_model->adminInfo();
$newStudentsList['students'] = $this->admin_model->newStudentsList($config['pre_page'],$this->uri->segment(3));
$data = array_merge($adminInfo,$newStudentsList);
$this->load->view('admin/newStudentsList',$data);
每个小小的工作都很好! 答案 0 :(得分:2)
您忘了一个配置:
$config['uri_segment'] = 5;
确定URI的哪个部分包含页码。
将pre_page
替换为per_page