PHP Pagination Class (MyPagina) ver. 1.04
updated: 2008-01-01
The page navigation (pagination) of lists with records from a (MySQL) database is often used on a lot of dynamic websites. This class is extremely easy to use in your existing application: just use your own SQL statement and voila you get information like the result set (you need this for later output, page navigation links and the (current) number of records. While using this class all other query string parts are included inside the page links. An example database table (with data) is included. The version 1.02 makes it possible to use images (back and forward navigation links).
PHP Script Download
You need to login or register to download this class script.
Downloaded 9631 times
Last changes and updates:
Version 1.04
Inside the example is a new navigation the showing only number in some collored boxes, these are added as an alternative type for a page navigation. There is also a new example for back- and forward links using text only. I fixed also some small bugs, one in the navigation() method, the start number for the page links was in some cases to high (if max links and number of link was the same) and one in the method get_page_result(). In this version there are also links for the first and the last page available under the conddition that the same link is not available with the other links (numbers). For this function there are new variables used in the class file and the configuration file. the methods navigation() and build_back_or_forward() are updated. The new function is disabled by default, check the updated example about how to use the feature.
Version 1.03
There is a new variable $max_rows, this variable is used to limit the maximum of results during a query. That will say if there are more rows then the number of $max_rows only the last one will show up. Use the new variable $outstanding_rows if you need to inform the user about that. Leave the value inside the constructor empty to disaple the function. Several variables are removed to give this class a safer and better structure. The method page_info() that builds the string with page number information is changed, only one (input) string (formatted with sprintf) is needed now.
Version 1.02
The link text (and the new image function) for the forward and backward links will be created with the new method build_back_or_forward(). Because there is no need anymore the variables str_forward and str_backward are removed. Check the example file for the possibility to use images in place of strings for the back- and forward navigation and the modified navigation() method.