Download the PHP package benjaminmedia/zebra-pagination without Composer
On this page you can find all versions of the php package benjaminmedia/zebra-pagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benjaminmedia/zebra-pagination
More information about benjaminmedia/zebra-pagination
Files in benjaminmedia/zebra-pagination
Package zebra-pagination
Short Description A generic, Twitter Bootsrap compatible, PHP pagination library that automatically generates navigation links
License LGPL-3.0
Homepage https://github.com/BenjaminMedia/Zebra_Pagination
Informations about the package zebra-pagination

Zebra_Pagination
A generic, Twitter Bootstrap compatible, pagination library that automatically generates navigation links
A generic, Twitter Bootstrap compatible, pagination script that automatically generates navigation links as well as next/previous page links, given the total number of records and the number of records to be shown per page. Useful for breaking large sets of data into smaller chunks, reducing network traffic and, at the same time, improving readability, aesthetics and usability.
Adheres to pagination best practices (provides large clickable areas, doesn't use underlines, the selected page is clearly highlighted, page links are spaced out, provides "previous page" and "next page" links, provides "first page" and "last page" links - as outlined in an article by Faruk Ates from 2007, which can now be found here, can generate links both in natural as well as in reverse order, can be easily, localized, supports different positions for next/previous page buttons, supports page propagation via GET or via URL rewriting, is SEO-friendly, and the appearance is easily customizable through CSS.
Please note that this is a generic pagination script, meaning that it does not display any records and it does not have any dependencies on database connections or SQL queries, making it very flexible! It is up to the developer to fetch the actual data and display it based on the information returned by this pagination script. The advantage is that it can be used to paginate over records coming from any source like arrays or databases.
The code is heavily commented and generates no warnings/errors/notices when PHP's error reporting level is set to E_ALL.
:books: Documentation
Support the development of this library
Features
- it is a generic library: can be used to paginate records both from an array or from a database
- it automatically generates navigation links, given the total number of items and the number of items per page (examples of best practices are also included)
- navigation links can be generated in natural or in reverse order
- it is SEO-friendly – it uses rel="next" and rel="prev" and solves the problem of duplicate content on the first page without navigation and the first page having the page number in the URL
- appearance is easily customizable through CSS
- compatible with Twitter Bootstrap
- code is heavily commented and generates no warnings/errors/notices when PHP’s error reporting level is set to E_ALL
- has awesome documentation
Requirements
PHP 5+
Installation
Download the latest version, unpack it, and load it in your project
Installation with Composer
You can install Zebra_Pagination via Composer
How to use
Make sure that in the
of your page you haveIf you want to preserve hashes in the URL, also include the JavaScript file – simply including it will suffice; (jQuery needs to also be loaded before loading this file)
Paginate data from an array:
The PHP
Would result is something like
You can set the navigation links' position to the left or to the right of the pagination links using the navigation_position() method:
Labels for "Previous" and "Next" links can be changed with the labels() method:
Paginate data from MySQL:
Paginate data from MySQL in reverse order:
Would result in something like
:books: Checkout the awesome documentation!