Mick Sear - 2005-06-28 07:09:04 - In reply to message 1 from Usayd
OK, the parameters are (in order):
1) The number of records you want to be displayed per page, which you'd set to match the number of database rows you're fetching from the database, the number of images you're displaying per page, etc. Since this is a generic pagination class, it could be any type of data, therefore the class doesn't actually manipulate your data for you. However, in order to correctly provide page links, it does need to know how many items you're showing per page
2) This is the total number of records. Note that it doesn't represent the total number of pages. The number of records is used, because the class keeps track of which page you're on by a $_GET parameter called 'start'. you can use this directly in SQL queries (after sanitising it) like this: limit $start,$start+$numPerPage
3) Since each page number is a link, the class needs to know the url that the link points to. Normally, you'd just set this to $_SERVER['PHP_SELF'] to go to the same page, but there are situations where you might want to add to the url or send to a different page, I guess, so you can set it here.
4) If you're paginating a lot of data, you could end up with hundreds of page links, which would look really messy, so the last parameter is the max number of page links to display. This is split either side of the current page, so if you're on page 30, you'll see pages 20-40 listed, plus first page and last page links, etc.
Hope this helps. I updated the class yesterday, so make sure you have the latest version. There was a small problem in some cases with the 'last page' link.