[eluser]Unknown[/eluser]
Hi guys,
Iam using CI Pagination class,I have a category listing page and sub category listing page,
In the category listing page the pagination link is working perfectly,When I click in one category name inside the category listing page,the id of the category is passing to subcategory index page,In that i want to list every sub category having the category id(passing id).
My subcategory index function like this..
function index($id,$page=0)
{
if ($this->session->userdata('logged_in') != TRUE)
{
redirect('login/index');
}
$data = array(
'catidlist' => $id,
);
$this->session->set_userdata($data);
$this->load->helper(array('form', 'url'));
$data['title'] = 'List subcategories';
$this->load->library('pagination');
$config1['base_url'] = base_url().'/index.php/list_subcategories/index/'.$this->session->userdata('catidlist').'/';
$config1['per_page'] = '2';
$this->load->model('list_subcategories_model');
$data['resultcatname']=$this->list_subcategories_model->FetchcateName($id) ;
$data['result'] = $this->list_subcategories_model->FetchLanguage() ;
$this->data['result'] = $this->list_subcategories_model->FetchLanguage() ;
for($i=0;$i<count($this->data['result']);$i++)
{
$this->data['cnt'][$i] = $this->list_subcategories_model->TotalRows($this->data['result'][$i]->id,$id);
$config1['total_rows'] = $this->data['cnt'][$i][0]->count ;
$data['res'][$i] = $this->list_subcategories_model->FetchSubCategory($this->data['result'][$i]->id,$id,$config1['per_page'],$page);
}
$this->pagination->initialize($config1);
$this->load->view('list_subcategories',$data);
}
Now the pagination link is coming in the right way..But when I click on the 2nd page,The current page doesn't set and also I cannot come in the first page also..The 2,3,4 pages are navigating but the current page doesn't set
Plz give me a good solution for it
Thank you