首页 > 代码库 > CI 结合Bootstrap 分页

CI 结合Bootstrap 分页

    #显示列表    public function index(){        //载入分页类       $this->load->library(‘pagination‘);        //每页显示的条数        $perPage=11;        /****配置分页****/        //设置分页路径        $config[‘base_url‘]=site_url(‘admin/locality/index‘);        //获取总条数        $config[‘total_rows‘]=$this->db->count_all_results(‘goods‘);        //每页显示条数        $config[‘per_page‘]=$perPage;        //设置uri片段        $config[‘uri_segment‘]=4;                //配置汉化        $config[‘first_link‘]="首页";        $config[‘prev_link‘]="上一页";        $config[‘next_link‘]="下一页";        $config[‘last_link‘]="最后一页";        //数字页        $config[‘num_tag_open‘] = ‘<li>‘;        $config[‘num_tag_close‘] = ‘</li>‘;        //当前页        $config[‘cur_tag_open‘] = ‘<li><a>‘;        $config[‘cur_tag_close‘] = ‘</a></li>‘;        //上一页        $config[‘prev_tag_open‘] = ‘<li>‘;        $config[‘prev_tag_close‘] = ‘</li>‘;        //下一页        $config[‘next_tag_open‘] = ‘<li>‘;        $config[‘next_tag_close‘] =‘</li>‘;        //首页        $config[‘first_tag_open‘] = ‘<li>‘;        $config[‘first_tag_close‘] = ‘</li>‘;        //最后一页        $config[‘last_tag_open‘] = ‘<li>‘;        $config[‘last_tag_close‘] = ‘</li>‘;                                //载入配置        $this->pagination->initialize($config);            //创建超链接        $data[‘links‘]=$this->pagination->create_links();        //var_dump($data);die;        //设置偏移量        $offset=$this->uri->segment(4);        //进行数据分页        $this->db->limit($perPage,$offset);                       $data[‘goods‘]=$this->goods->goods_list();       $this->load->view(‘admin/goods_list.html‘,$data);    }