PHP Classes

Mini Paginator: Show links to browse paginated listings

Recommend this page to a friend!
  Info   Example   Demos   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 428 All time: 6,335 This week: 43Up
Version License PHP version Categories
mini-paginator 1.0.0Freely Distributable5.0HTML, PHP 5
Description 

Author

This class can show links to browse paginated listings.

It takes as parameters the total number of entries in a listing, the limit of entries to show per page, and generates HTML to display links to browse the listing pages, getting the current page number from a request parameter.

The number of navigation links is limited to a given number.

The style of the pagination links can be set to two pre-configured light and dark styles or use a custom style defined in CSS.

Picture of Wilson Fernandez
  Performance   Level  
Name: Wilson Fernandez <contact>
Classes: 1 package by
Country: Argentina Argentina

Example

<?php
// connection to the base //
$link = mysql_connect("localhost", "test", "password");
$db_selected = mysql_select_db("wilson_test", $link);

// first query //
$result1 = mysql_query("SELECT * FROM productos", $link);
$num_rows = mysql_num_rows($result1);

// required data //
$total_results = $num_rows; // total results from a query
$maximum_per_page = 3; // maximum results to show per page
$maximum_links = 5; // maximum links to show

// pagination process //
require_once("paginator/paginator.class.php");
$page = new Paginator();
$pagination = $page->paginate($total_results, $maximum_per_page, $maximum_links, "Light");

// second query //
$result2 = mysql_query("SELECT * FROM productos LIMIT $page->limit", $link);

// query results //
echo "<h1>Mini Paginator demo</h1>";
echo
"<table border='1' align='center'>";
while (
$row = mysql_fetch_array($result2))
{
    echo
"<tr><td>".$row['codigo']."</td><td>".$row['producto']."</td><td>".$row['precio']."</td></tr>";
}
echo
"</table>";

// paginator //
echo $pagination;
?>


  Mini Paginator DemoExternal page  
Screenshots (2)  
  • screenshot
  • screenshot2
  Files folder image Files (12)  
File Role Description
Files folder imagepaginator (2 files)
Files folder imagescreenshots (6 files)
Accessible without login HTML file documentation.html Doc. documentation.html
Accessible without login Plain text file test.php Example test.php

  Files folder image Files (12)  /  paginator  
File Role Description
  Plain text file paginator.class.php Class paginator.class.php
  Accessible without login Plain text file style.css Data style.css

  Files folder image Files (12)  /  screenshots  
File Role Description
  Accessible without login Image file 1.jpg Photo screenshots
  Accessible without login Image file 2.jpg Photo screenshots
  Accessible without login Image file 3.jpg Photo screenshots
  Accessible without login Image file 4.jpg Photo screenshots
  Accessible without login Image file 5.jpg Photo screenshots
  Accessible without login Image file 6.jpg Photo screenshots

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:428
This week:0
All time:6,335
This week:43Up