![]() |
Page Links in pagination behaving funny - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Page Links in pagination behaving funny (/showthread.php?tid=8497) |
Page Links in pagination behaving funny - El Forum - 05-20-2008 [eluser]chinedubond[/eluser] Page Links in pagination behaving funny Hello the links in my pagination is behaving kinda funny when the search result page first loads , the pagination links for example shows <1,2> so when u go to the next result set by click on the number 2 link the result set does come up i.e it pulls the correct result set but the produce is instead of the pagination link showing <1,2> .It is still showing <1,2> . so there is no way of navigating to the previous result set . Thank you. Code: This is Model <?php class Searchcontrollers extends Controller { function Searchcontrollers() { parent::Controller(); $rules['keyword'] = "required|min_length[3]"; $rules['locationField'] = "required|min_length[3]"; $this->validation->set_rules($rules); $fields['keyword'] = 'keyword'; $fields['locationField'] = 'location'; $this->validation->set_fields($fields); $this->load->library('session'); } function getResultsByKeyword(){ getListByKeyword($keyword); } function validateSearch(){ $this->load->library('validation'); //$this->load->library('indexcontroller'); if ($this->validation->run() == FALSE) { $this->setFields(); $this->searchResults(); } else { $this->setFields(); $this->searchResults(); } } function searchResults(){ $this->load->model('search/searchmodel', 'searchmodel', TRUE); $data['title']="Search Results "; $num=2; $segment=$this->uri->segment(4); $keyword=$this->session->userdata('keyword'); $city=$this->session->userdata('city'); $data['searchresults'] = $this->searchmodel->getSearchResults($keyword,$city,$num,$segment); $config['base_url'] = base_url().'index.php/search/searchcontrollers/searchResults/'; $config['total_rows'] = $this->searchmodel->getSizeofResults(); echo 'total rows '.$config['total_rows']; $config['per_page'] = '2'; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>'; $this->pagination->initialize($config); $this->load->view('indexsearch',$data); } function setFields(){ $keyword = $this->input->post('keyword'); $city = $this->input->post('locationField'); $newdata = array( 'keyword' => $keyword, 'city' => $city); $this->session->set_userdata($newdata); } } ?> Page Links in pagination behaving funny - El Forum - 05-20-2008 [eluser]Silvrbak[/eluser] Setting the URI segment in your pagination config should fix it, $config['uri_segment]. Page Links in pagination behaving funny - El Forum - 05-21-2008 [eluser]chinedubond[/eluser] hi ,you are a genius!! that was the answer. i actually got that done yesterday before reading this post. wish i had done it sooner.thanks a lot Page Links in pagination behaving funny - El Forum - 05-21-2008 [eluser]Silvrbak[/eluser] Your welcome. |