I'm experiencing very strange problem with pagination. I'm draging data from DB and setting paggination for it. But for some reason, the pagination's active page is not working at all, it is all the time set to the first page.
Here is my code:
//load the model
$this->load->model('shops_model');
// load pagination class
$this->load->library('pagination');
/* setting for the pagination */
$config['base_url'] = base_url().'/shop';
$config['total_rows'] = $this->shops_model->record_count();
$config['per_page'] = '3';
$config['first_link'] = '';
$config['last_link'] = '';
$config['use_page_numbers'] = false;
$config['page_query_string'] = FALSE;
$config['full_tag_open'] = '';
$config['full_tag_close'] = '';
$config['first_tag_open'] = '
';
$config['first_tag_close'] = '
';
$config['first_tag_open'] = '
';
$config['first_tag_close'] = '
';
$this->pagination->initialize($config);
$vars['pagination'] = $this->pagination->create_links();
$vars['items'] = $this->shops_model->find_all(null, 'id asc', $config['per_page'],$this->uri->segment(2));
// use Fuel_page to render so it will grab all opt-in variables and do any necessary parsing
$this->load->module_library(FUEL_FOLDER, 'fuel_page', array('location' => 'shop/layout'));
$this->fuel_page->add_variables($vars);
$this->fuel_page->render();
}
Comments
How can you render fuel page and direct it to the separated module folder? In my case I would like to call views,models not the one which are located in application/views, but the one in fuel/modules/shop/views?
public $view_location = "shop";
to your controller before the contstructor.