Forms and Pagination Quick fix - 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: Forms and Pagination Quick fix (/showthread.php?tid=36959) |
Forms and Pagination Quick fix - El Forum - 12-21-2010 [eluser]Richievc[/eluser] Hi all after a few ways of trying to add form post functionility to the Pagination I found that this is the best for me. So here we go First you want to extend the Pagination Class First Method Code: function get_query_segments() { This Method add a Value pairs to the segments ie. class/method/20/name:richie/ Next: due to limit space I'll post only the changes of this method extending the create_links() Method Find this and add the 0 This ensure the 3 segment is occupied Code: $n = ($i == 0) ? '0' : $i; || old n = ($i == 0) ? '' : $i; For the links change to this it add the segment pairs to the end of each link Code: $this->base_url.$n.$this->get_query_segments() Next we need to extend the Form_validation Class we added this method Code: function check_segments($fields) { Method 2 Code: function segments($fields) { method 3 Code: function set_value($field = '', $default = '') { Query Usage Code: if(!empty($this->form_validation->segments('name'))) { Please let me know what you think or if there is a better way thx |