Pagination with "real" pages |
[eluser]jlevine[/eluser]
I saw a couple threads about this from earlier in the month. The Pagination library uses offset values for pages instead of the actual page number. I've extended the core Pagination class and you can optionally use actual page numbers instead of offset values. It is identical in use to the original Pagination class with the exception of the name of the library when loading it and an optional paramater for create_links(). Installing Simply drop the MY_Pagination.php file attached to this post into your 'application/libraries' folder. Usage Example Code: $this->load->library('my_pagination'); create_links() This function now accepts $use_offsets as a parameter which can be TRUE or FALSE (TRUE by default). When set to FALSE, links use actual page numbers and offset values when set to TRUE. I haven't tested this outside my own WAMP setup so any feedback would be appreciated.
[eluser]Colin Williams[/eluser]
Contributions are welcome, but modifying core classes are not. Please read the guidlines for extending core classes in the user guide. Some solid documentation would help, too. CI even distributes a CSS/HTML template to match the look and feel of their user guide.
[eluser]jlevine[/eluser]
[quote author="Colin Williams" date="1217213930"]Contributions are welcome, but modifying core classes are not. Please read the guidlines for extending core classes in the user guide. Some solid documentation would help, too. CI even distributes a CSS/HTML template to match the look and feel of their user guide.[/quote] Sorry, I'm still new to CI, but thanks for the advice. I took my modified library down and am in the process of modifying it to be within the guidelines. I'll post it a little later today when it's finished.
[eluser]fustaki[/eluser]
Maybe I noticed a little error using your MY_pagination library: when rendering the link for the first page the URL is Code: http://example.com/index.php/test/page/1 Code: http://example.com/index.php/test/page/ I just added the control on page 1 Code: $n = ($i == 0 || $i == 1) ? '' : $i Is there a 'trusted' version of your pagination extension within the guidelines? anyway, good job! bye ;-) |
Welcome Guest, Not a member yet? Register Sign In |