标签:
在网上找了半天,没有一个能写明白的,到的怎么使用带条件分页,我这里用简单说明实现它!
1.使用CI框架分页类,如果带搜索条件,首先要可以接收搜索内容
$cateid = $this->input->get_post(‘select_cate‘); $searchkey = $this->input->get_post(‘searchkey‘); $offset = $this->input->get_post(‘per_page‘);
2.实现搜索分页代码
$this->load->library("pagination"); $config[‘base_url‘] =site_url(‘shop/shopmanagereply‘)."?select_cate=$cateid&searchkey=$searchkey"; $config[‘total_rows‘] = $data[‘total‘]; $config[‘per_page‘] = 20; $config[‘first_link‘] = ‘首页‘; $config[‘prev_link‘] = ‘上一页‘; $config[‘next_link‘] = ‘下一页‘; $config[‘last_link‘] = ‘尾页‘; $config[‘page_query_string‘] = TRUE; $this->pagination->initialize($config); $data[‘links‘] = $this->pagination->create_links();
安装这段代码开发,就可以实现带条件搜索分页了,简单吧!
标签:
原文地址:http://www.cnblogs.com/feimengv/p/4281810.html