Pagination plugin |
[eluser]xwero[/eluser]
There are already a few pagination plugins out there, Flexible Paging Plugin and Paging Simplified can be found in the wiki and there will be more if you do a search. But they didn't do it for me so i created my own. The main reason why i made the pagination a plugin and not a library is because i wanted to use CI functionality. IMO should a library be framework independent. And the CI pagination only has one functional method, create_links, so it's perfect to make a plugin out of it. Why you should use it: - It separates the output from the link creation, this means no template settings. - It's easier to finetune the link output. - Because each time the links are created you donate a cent to a good cause, yes it's infected with goodware. The zip file contains the plugin file, a few view files and the plugin documentation. All comments and bug reports are welcome in this thread.
[eluser]Phil Sturgeon[/eluser]
Looking good xwero. I always hate pagination so anything to make the CI lib easier to work with is welcomed.
[eluser]xwero[/eluser]
To set the record straight, the plugin is a library replacement.
[eluser]xwero[/eluser]
I made a universal function from my pagination plugin Code: function getLinks($viewPath,$currentPage,$totalPages,$totalLinks=0) Code: <ul> Code: function viewPath($view) The output of the functions doesn't need to be echo-ed, if you do echo it you will see 0 or 1 appear because the echo outputs the include function result. If you want the output buffering functions can be added to prevent this.
[eluser]abada[/eluser]
please can u explain more for how to use it where models ? thanks
[eluser]xwero[/eluser]
the only parameter that could be powered by a model is totalPages. The plugin doesn't need to know how many rows are getting displayed, it just has to take care of the link generation.
[eluser]wiredesignz[/eluser]
This is a very nice Pagination Widget xwero. Good work man.
[eluser]abada[/eluser]
thanks xwero for ur help but really i don`t know how to use it .. i just copy pagination_pi.php in "system/plugins" ... and now what after that i mean (where controller and model and view )... do i do in user guide http://ellislab.com/codeigniter/user-gui...ation.html or what ? ... please ....
[eluser]xwero[/eluser]
wiredesignz now that you called it a widget i'm moving the view out of the function Code: function getLinks($totalPages,$currentPage=0,$formattedLink='',$totalLinks=0) So the new usage examples are Code: // controller Code: // controller The function returns an array that is generated based on the parameter input. totalPages is the maximum amount of links that is going to be created. currentPage is the segment/variable(for example session item) that defines the pagenumber. formattedLink creates links if you want them this will change the output of the link parts from a numeric value to an array with the keys nr and link. It uses sprintf to format the links. totalLinks is the amount of links you want to be visible, first, last, next and prev links excluded. The amount center is the current page. |
Welcome Guest, Not a member yet? Register Sign In |