Implementing PHP Pagination for a SQLite query set

aaronkomodo

New Member
I'm looking for a good function for implementing pagination in a PHP site. The solution needs to work for vanilla PHP (no template language, no frameworks, etc). I'd like to be able to put something like the following in my code:\[code\]<? $widgets = ... (some query)?>Page content here.<?= paginate($widgets) ?>\[/code\]This would output something like the following:\[code\]Page content here.1 <a href='http://stackoverflow.com/questions/2015598/?page=2'>2</a> <a href='http://stackoverflow.com/questions/2015598/?page=3'>3</a> . . . \[/code\]Then, there is the issue of filtering my query. I could query twice, once to get a count of total objects and once with a limit clause to get the specific "widgets" that I need.Are there any simple PHP functions that can elegantly encapsulate this functionality, or is it something best done by hand? I think I've become spoiled by django-pagination, but this project requires a PHP solution.
 
Back
Top