Pagination problem (create link) |
[eluser]Unknown[/eluser]
I'm trying to display data with pagination. From the code below, my page can display the page link " 1 2 3 4 > Last › " I get the right result when I click on the number, but the current page always 1. Then the next button just work once, from page 1 to page 2. The page link never refresh. I don't know what's wrong with my code... Can someone help me? Here is my code : public function index($offset) { $vars = array(); $options = array(); $this->load->model('category'); $this->category->order_by('kategori_id', 'asc'); $this->category->limit(20, $offset); $vars['results'] = $this->category->get_result(); $this->load->library('pagination'); $config['base_url'] = 'http://localhost/jawaban/index2.php/admin/categories/index'; $config['total_rows'] = $this->category->get_cat_numrows(); $config['per_page'] = 20; $config['num_links'] = 3; $this->pagination->initialize($config); $vars['create_links'] = $this->pagination->create_links(); $this->_vars['html_title'] = "Categories"; $this->_vars['html_scripts'] = ""; $this->_vars['html_styles'] = ""; $this->_vars['menu'] = $this->load->view('admin/menu', "", TRUE); $this->_vars['page'] = $this->load->view($this->get_page_path() . 'index', $vars, TRUE); }
[eluser]umefarooq[/eluser]
hi just put and check. Code: $config['uri_segment'] = 4; The pagination function automatically determines which segment of your URI contains the page number. If you need something different you can specify it. check user guide also http://ellislab.com/codeigniter/user-gui...ation.html
|
Welcome Guest, Not a member yet? Register Sign In |