|
controller
function show_page() {
$this->load->library('pagination');
$config['base_url'] = base_url().'cate/show_page';
$config['total_rows'] = $this->db->count_all('cate');
$config['per_page'] = '5';
$config['first_link']='首页';
$config['last_link']='末页';
$config['next_link']='下一页';
$config['prev_link']='上一页';
$this->pagination->initialize($config);
$data['page_bar'] = $this->pagination->create_links();
$this->load->model('mcate');
$data['results'] = $this->mcate->pages($config['per_page'],$this->uri->segment(3));
$this->load->view('cate/cate_show', $data);
}
model
function pages($num, $offset) {
$query = $this->db->get('cate', $num, $offset);
return $query->result_array();
}
view
<div>
<?php echo $page_bar;?>
</div>
报错说$page_bar找不到? 为什么? |
|