Customize Pagination class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Customize Pagination class (/showthread.php?tid=24351) |
Customize Pagination class - El Forum - 11-07-2009 [eluser]web_developer[/eluser] Hello, I want to customize Pagination class. I have to show page link in range.. ($config['total_rows']) For exmple like below |<< << 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 >> >>| if User go to page number 11 then link should be display 11 - 20 (In short need to display links in range) 1 - 10 11 - 20 21 - 30 and so on... So for that what change required to do? Customize Pagination class - El Forum - 11-08-2009 [eluser]CoolGoose[/eluser] You can change set the num_links setting to have a different value. Code: $this->load->library('pagination'); /le Ah, damn. I just noticed that you want the First Link from that Listing to be the first one. /le 2 Create your own library based on CI's one and fiddle with Code: $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; Customize Pagination class - El Forum - 11-08-2009 [eluser]CoolGoose[/eluser] I think I nailed it: Code: // Calculate the start and end numbers. These determine Not really tested . Customize Pagination class - El Forum - 11-08-2009 [eluser]web_developer[/eluser] Ok got it.. So for that I have to use my own logic, Such type of functionality will not work in Pagination defaault library... I was thinking that if this can manage with pagination library then it would become good. But any way Now I will create my own pagination for that. Thanks for helping.. Customize Pagination class - El Forum - 11-08-2009 [eluser]CoolGoose[/eluser] Just try with that bit of code before you create one from scratch. So copy the whole pagination class, rename the class to something else like WD_pagination, save it as wd_pagination.php into your library directory and replace the $start / $end part from it with what I wrote above. In any case, keep us informed about your progress . |