public function index() { $this->load->library('pagination'); $config = page_config($this->db->count_all('manager'), '/manager/index'); $this->pagination->initialize($config); $data['Allmanager'] = $this->Manager_model->findAll($config['per_page'], $this->uri->segment(3)); $this->load->view('/admin/manager/manager', $data); }
public function index() { $this->load->library('pagination'); $config = page_config($this->db->count_all('brand'), '/brand/index'); $this->pagination->initialize($config); $data['AllBrand'] = $this->Brand_model->findAll($config['per_page'], $this->uri->segment(3)); $this->load->view('/admin/brand/show', $data); }
/** * @brief 分页 * @param $url string 输出地址 * @param $per_page int 每页个数 * @param $where array/string 查询条件 * @param $uri int page 所在参数位置 * @return */ protected function _pages($url, $per_page = -1, $where = false, $all_num = 0, $uri = 3) { if (!$per_page < 0) { $per_page = $this->page_limit; } $this->load->library('pagination'); $this->pagination->initialize(page_config($per_page, $all_num, $url, $uri)); return $this->pagination->create_links(); }
public function index() { $sid = '0'; $this->load->library('pagination'); $this->load->helpers('request'); if ($this->input->get('sid')) { $sid = $this->input->get('sid'); $data['OneNav'] = $this->Nav_model->findOne(); } $config = page_config($this->db->from('nav')->where('sid', $sid)->count_all_results(), '/nav/index'); $this->pagination->initialize($config); $data['AllNav'] = $this->Nav_model->findAll($config['per_page'], $this->uri->segment(3), $sid); $this->load->view('admin/nav/show', $data); }
public function find($page = 1) { $limit = 10; $vdata = array('status' => 0, 'msg' => '未输入关键词!'); if ($str = $this->input->get('w')) { // 元个数大于5 if (mstrlen($str) > 5) { $str = get_str_tags(html2txt($str)); } if ($data = $this->model->find_list($str, $limit, $limit * ($page - 1))) { $vdata = $data; $vdata['status'] = 1; $vdata['msg'] = "获取数据共" . $vdata['count'] . "条"; //分页 $this->load->library('pagination'); $this->pagination->initialize(page_config($limit, $vdata['count'], site_url('tags/find/'))); $vdata['pages'] = $this->pagination->create_links(); } } $this->output->set_content_type('application/json')->set_output(json_encode($vdata)); }