This is the ultimate pagination class that allows you to easily deliver your content in bite-sized chunks. Go ahead and play around.
The code for the above is written thus:
$page->link('pagination.css');
$links = new Pagination (1000);
$html .= $links->display();Two excellent resources are at:
This is the constructor for the class, and it creates a pagination object.
| $query | A MySQL query that returns the total number of records, or if you already know then you can just put the number here. |
| $display | How many records you would like to display at a time. |
| Example | $links = new Pagination ("SELECT COUNT(*) FROM table"); |
This method will return the appropriate ' LIMIT start, display' string for your query to return the desired records.
| Returns | A string to finish off your MySQL query. |
| Example | $result = db_query ("SELECT * FROM table" . $links->limit()); |
This is the paginator method. Put it where you want your links to be displayed.
| $split | How many links you would like to be on either side of the current page. |
| Returns | A string of code to add to your $html. |
| Example | $html .= $links->display(); |