|
楼主 |
发表于 2010-4-30 16:28:27
|
显示全部楼层
本帖最后由 atxlin 于 2010-4-30 16:29 编辑
//分页
function page() {
$this->load->library('pagination');
$config['base_url'] = base_url().'/custom/page/';
$config['total_rows'] = $this->db->count_all('custom');
$config['per_page'] = 5;
$config['uri_segment'] = 3;
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$this->pagination->initialize($config);
$this->load->model('custom_model');
$data['results'] = $this->custom_model->get_books($config['per_page'],$this->uri->segment(3));
$this->load->view('defult', $data);
}
//分页
function get_books($num, $offset) {
$query = $this->db->get('custom', $num, $offset);
return $query;
}
$config['base_url'] = "http://localhost/ci/";
index.php我根据教程去掉了
<?php echo $this->pagination->create_links(); ?> |
|