|
我的url类似:http://www.xxx.com/info/dolist/1/8
1是分类,8是偏移量
结果是第一页的链接总是不可用的。
PHP复制代码
function dolist (){
/**
*显示供求信息的分类列表,分页
*update:2008-02-22
*/
//由url取得要列表的类别
$cid = $this->uri->segment(3,0);
$this->load->library('pagination');
$config['base_url'] = base_url ().'info/dolist/'.$cid.'/';
$this->db->select('id');
$this->db->from('info');
$this->db->where('pass',1);
$this->db->where('class',$cid);
$query = $this->db->get();
$config['total_rows'] = $query->num_rows();
$config['per_page'] = '8';
$config['num_links'] = '4';
$config['first_link'] = 'First';
$config['last_link'] = 'Last';
$this->pagination->initialize($config);
$this->db->select('info.id as id, title, logo, content, companyname, state, city');
$this->db->from('info');
$this->db->join('company','info.cid = company.id','left');
$this->db->where('info.pass',1);
$this->db->where('info.class',$cid);
$this->db->orderby('info.id','desc');
$this->db->limit($config['per_page'],$this->uri->segment(4,0));
$data['info_list'] = $this->db->get();
$this->load->view('template/info',$data);
}
复制代码
[ 本帖最后由 kissmumu 于 2008-2-22 16:54 编辑 ] |
|