PHP Classes

Mini Paginator: Show links to browse paginated listings

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 427 All time: 6,337 This week: 571Up
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
Age: 50
All time rank: 345546 in Argentina Argentina
Week rank: 4375 Down58 in Argentina Argentina Down

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  
  • screenshot
  • screenshot2
  Files folder image Files  
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  /  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  /  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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:427
This week:0
All time:6,337
This week:571Up