![]() |
Pagination automated - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Pagination automated (/showthread.php?tid=10330) |
Pagination automated - El Forum - 06-01-2009 [eluser]JoostV[/eluser] Hi Dine, First off, this lib is intended for use with default CI URI's, that is: not including a query string (like ?keywords=&search_type=all), so you should expect to find some problems there. Having said that, I think the problem here is that you switch between manual sql and active record in your queries. I'm not sure if that is at all possible. I think not. This is probably why limit is not in your query. Code: $query = "select SQL_CALC_FOUND_ROWS * from tbl_users where 1=1 "; Try to write the entire query in active record format, for instance Code: // Set up SQL Pagination automated - El Forum - 10-25-2009 [eluser]JoostV[/eluser] A tweaked version of this lib is now in the Wiki. Pagination automated - El Forum - 01-02-2010 [eluser]Peter Lachky[/eluser] Hi JoostV, thanks for great job! However, I've got one question anyway. The lines 156 and 164 of your library (as it is in wiki) uses Code: $CI->config->item('base_url') Code: $CI->config->item('index_page') Code: $this->base_url = $CI->config->item('base_url') . $CI->config->item('index_page') . '/' . substr($CI->uri->uri_string(), 1) . '/' . $this->pagination_selector; I hope I'va made my point - correct me if I am wrong. Thanks a lot! Pagination automated - El Forum - 01-07-2010 [eluser]iamjerson[/eluser] Thanks for this lib it saves my time Pagination automated - El Forum - 10-31-2010 [eluser]Unknown[/eluser] great work, just that i need Pagination automated - El Forum - 01-05-2011 [eluser]Unknown[/eluser] Cool thanks for the help ![]() Pagination automated - El Forum - 02-22-2011 [eluser]Unknown[/eluser] Great stuff ![]() thanks Pagination automated - El Forum - 02-22-2011 [eluser]seeraw[/eluser] Hi everyone, Great!!! and here is the complete working stuff no need to change any file Write this code in your controller. $arr['cnt']=$this->login_model->getAllCastChar(); $this->load->library('pagination'); $config['base_url'] = site_url().'HERE IS YOUR CONTROLLER NAME'; $config['total_rows'] = count($arr['cnt']); $config['per_page'] = '10'; $config['num_links'] = 4; // IT MAY VARY $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>'; $config['uri_segment'] = '4'; $this->pagination->initialize($config); $arr['data']=$this->login_model->getAllCastCharAdmin($config['per_page'],$this->uri->segment(4)); $this->load->view('VIEW NAME',$arr); Pagination automated - El Forum - 05-10-2013 [eluser]bluehat09[/eluser] Add in your routes.php Code: $route['archives/page/:num'] = "archives/index/page/:num"; [quote author="wdm*" date="1223382981"]I get a "page not found" when using the pagination links with my default "archives" controller / index view. This works: Code: http://beta.archiv.local/archives/index/offset/5 These don't work: Code: http://beta.archiv.local/offset/5 Thanks for your work Joost Pagination automated - El Forum - 07-17-2013 [eluser]quickshiftin[/eluser] Very nice contribution! |