PHP Classes
elePHPant
Icontem

PHP Pagination Links: Display links to browse pages of entry listings

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-12-26 (1 year ago) RSS 2.0 feedNot enough user ratingsTotal: 175 This week: 1All time: 8,279 This week: 672Up
Version License PHP version Categories
pagination-links 1.0.0MIT/X Consortium ...5HTML, Databases
Description Author

This class can display links to browse pages of entry listings.

It can take as parameter the total number of entries in a listing, the limit number of entries to display per page and the number of the current listing page.

The class can generate links to browse to the other pages of the listings.

The format of the link URLs, show the first and last links, show links a page numbers are configurable options.

  Performance   Level  
Name: Miraz Mac <contact>
Classes: 5 packages by
Country: Bangladesh Bangladesh
Age: 23
All time rank: 306444 in Bangladesh Bangladesh
Week rank: 89 Up3 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 2x

Details

PaginationLinks

Yet another PHP class to generate pagination links in PHP.

Looking for a quick way to generate pagination links? Say no more! Though the code is well commented and there is a full example inside examples directory I would still write some basic documentation here.

Install via Composer <3

composer require mirazmac/pagination-links

PaginationLinks Options

Pagination links has these options to control its appearance/behavior.

$OPTIONS = array(
	/
	 * The base URL
	 * %_PAGE% - Prints the page number
	 * %_QUERY% - Appends the current GET Query
	 */
	'url' => '?page=%_PAGE%&foo=bar%_QUERY%',

	/ Toggle the `First & Last` Links */
	'show_extra' => true,

	/ Toggle numeric pagination ( 1 2 3 4...8 ) */
	'show_numeric' => true,

	/
	 * The GET key to skip from appending in %_QUERY%
	 * append_get_queries must be set to true if you want to use this
	*/
	'get_key_to_skip' => array('foo', 'cool', 'bar'),
	);

Getting Started

To use PaginationLinks you must include it it your project.

require_once 'src/PaginationLinks.php';
use mirazmac\PaginationLinks;
$pagination = New PaginationLinks();
// Optionally, You can pass an array of options in constructor
$pagination = New PaginationLinks($OPTIONS);

Build the Pages

This is a MUST do to build the pages after constructing the class. Just like this:

/*
 * Build the Pagination links
 *
 * @param  integer  $total        Number of total items
 * @param  integer  $current_page Number of current page
 * @param  integer $per_page     Number of Items per page (defaults to 10)
 * @return boolean               Returns always true.
 */
$pagination->buildPages($total, $current_page, $per_page);

Show the PaginationLinks

After building the pages, you can show it just like this ( I ain't gonna say this anymore -_- )

// Voila!!
echo $pagination->getPages();

No more docs!

Please read the code, explore the example! Sorry for my bad English -_-

  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file PDOExample.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file PaginationLinks.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 0%
Total:175
This week:1
All time:8,279
This week:672Up