我有codeignitet分页和路线的问题!
我像这样设置我的函数类的路由:
$route['admin/panel/students/new-stuedents-list/:num'] = "admin/newStuedentsList/$1";
然后在我的控制器中,我创建了一个调用 newStuedentsList
和加载分页库的函数,一切正常,但分页导航...... :(
页面加载成功......
并且数据正确......
当我点击示例页面时蝙蝠2,第2页加载成功,但分页导航显示第i页按钮...!
当我调用第4页表单url(http://localhost/d/index.php/admin/panel/students/new-students-list /30) ,数据又是正确的......但是分页导航显示第1页按钮和页数没有改变!
$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);
一切正常!
我该如何解决这个问题......?