|
学习一哈子视频教程中的分页
我只在view中有个index,默认读取所有列表,打算给该列表加分页
index中列表和分页都有了,但点击分页就是404了,帮我看看错在哪?
- function index()
- {
- $this->load->library('pagination'); //加载分页类
- $this->load->model('Mhome');
- $data['web_title']='WEB_TITLE';
- $this->load->view('web_meta',$data);
- $this->load->view('web_header');
- //分页参数
- $config['base_url'] = base_url().'index.php/home/';
- $config['total_rows'] = $this->Mhome->select_num_rows(); //数据总数
- $config['per_page'] = 3;
- $config['uri_segment'] = 1;
- $config['full_tag_open'] = '<p>';
- $config['full_tag_close'] = '</p>';
- $config['first_link'] = 'First';
- $config['last_link'] = 'Last';
- $config['prev_link'] = '<';
- $config['next_link'] = '>';
- $this->pagination->initialize($config);//初始化分页
- $data['article_list'] = $this->Mhome->get_page($this->uri->segment(3,0),$config['per_page']);
- $this->load->view('index',$data);
- $this->load->view('web_footer');
- }
复制代码 |
|