Thread: Pagination
View Single Post
Old 12-06-2007, 05:33 PM   #11 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

It is what it is: a nice and simple pagination class. If you were to get all complex about it then I'd be inclined to take the approach of passing in the format you wish the pagination to be returned as. Such as:

php Code:
$pObj = new Pagination(new Pagination_Ellipsis());

It would also be more programmer-friendly if you could pass in the total amount of records into the class, and how many you would like per page - and if you wanted to take that further then which column you want the items to be ordered by.

In fact, thinking about it, instead of passing in the SQL result yourself, you would specify just the SQL clause and the class would do the rest for you. For example:

php Code:
$pObj   ->  setTable('users')
        ->  setClause('ORDER BY username ASC')
        ->  setPerPage(10);

Unless anybody has a better solution then that's how I would currently do it if I were to write a pagination class, in conjunction with the passing in the pagination type to the class construct.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote