pagination current page class not working |
[eluser]Unknown[/eluser]
I am using CI pagination for listing sub categories of a category,In that I need to pass category id to subcategory function,I attached my code below..Here $id stands for category id that I pass when clicking the link of category name. So I gave $config['base_url'] = base_url().'/user.php/login/listsubcategory/'.$this->session->userdata('catid'); Now the pagination is working clearly,But the page number 1 is active every time,when i click pageno 2 pagination is working but not current page (bold) is not working and also I cant go to page no 1 again,because it is active every time,if am in page no 2,3 etc. My url is http://www.galtech.org/craigslist/user.p...tegory/1/3 where 1 is the category id and 3 is page no,I think the pagination class considering the first argumenet as current page that means 1,any solution for this..?? function listsubcategory($id,$page=0) { $data = array( 'catid' => $id, 'currpage' => 'login/listsubcategory/'.$id, ); $this->session->set_userdata($data); $this->load->model('login_model'); $this->load->library('pagination'); $config['base_url'] = base_url().'/user.php/login/listsubcategory/'.$this->session->userdata('catid'); $config['per_page'] = '3'; $this->data['cnt'] = $this->login_model->TotalRows($this->data['flag'][0]->flag,$language,$id); $config['total_rows'] = $this->data['cnt'][0]->count ; $this->data['listpostscategory'] = $this->login_model->Fetchpostscategory($this->data['flag'][0]->flag,$language,$id,$config['per_page'],$page); $this->pagination->initialize($config); $this->index(); }
[eluser]samvirtual[/eluser]
I am having the exact problem with codeIgniter 2. apparently i am doing something wrong. But what?
[eluser]osci[/eluser]
Code: //change You are passing wrong segment. Take a loom at User Guide - Pagination and post your code in [ code][ /code] tags next time (without the space)
[eluser]InsiteFX[/eluser]
You must also specify the url segment! Code: // controller/method/id InsiteFX
[eluser]osci[/eluser]
[quote author="osci" date="1307229733"] Code: //change You are passing wrong segment. Take a loom at User Guide - Pagination and post your code in [ code][ /code] tags next time (without the space)[/quote] lol, wrong answer. I was talking about segments but I wrote per page :/
|
Welcome Guest, Not a member yet? Register Sign In |