LucidLab Webdesign, photography and cyber culture

LucidLab

Easy to use PHP pagination

If you list hundred or thousand records from a database on your website, it is unconfortable to show all of these on one page. So I wrote a pagination function in PHP to browse through the pages like browsing through google results with a previous and next link. It is also simple to customize the design. Just change the styles in the numlinkstyle.css stylsheet file.

Example:

Download:

Numlinks V1.0

Usage note:

  1. Download numlinks.zip
  2. Extract it and upload all files to your webserver (run the numlinksexample.php to see how it works)
  3. You have to import the numlinkfuctions.php with require_once(’numlinkfunctions.php’); into your script.
  4. Also import the numlinkstyle.css in your HTML header with <link rel=”stylesheet” type=”text/css” href=”numlinkstyle.css”>
  5. Insert the function numlinks($pagenum, $maxpage, $pages_visible, $scriptname, $get); with the following parameters into your PHP code:
    $pagenum: Number of the current page
    $maxpage: Number of all pages
    $pages_visible: Maximum number of pages to be displayed (usually a odd number)
    $scriptname: Optional – File to which a number links
    $get: Optional – to deliver custom GET parameters (e.g. foo=bar&email=bla@hotmail.com)

Any Questions? Leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>