Download the PHP package stefangabos/zebra_pagination without Composer
On this page you can find all versions of the php package stefangabos/zebra_pagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stefangabos/zebra_pagination
More information about stefangabos/zebra_pagination
Files in stefangabos/zebra_pagination
Package zebra_pagination
Short Description A generic, Twitter Bootstrap compatible, PHP pagination library that automatically generates navigation links
License LGPL-3.0
Homepage https://github.com/stefangabos/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 (versions 3, 4 and 5), 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.
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 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 versions 3, 4 and 5
- code is heavily commented and generates no warnings/errors/notices when PHP's error reporting level is set to E_ALL
- has awesome documentation
:notebook_with_decorative_cover: Documentation
Check out the awesome documentation!
🎂 Support the development of this project
Your support means a lot and it keeps me motivated to keep working on open source projects.
If you like this project please ⭐ it by clicking on the star button at the top of the page.
If you are feeling generous, you can buy me a coffee by donating through PayPal, or you can become a sponsor.
Either way - Thank you! 🎉
Requirements
PHP 5+
Installation
You can install Zebra Pagination via Composer
Or you can install it manually by downloading the latest version, unpacking it, and then including it in your project
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:
You can also have HTML markup as labels making it easy to include font icons like the ones from Font Awesome
Using condensed navigation where only links to first, last, next and previous pages are available. Useful when there isn't enough space for a full blown pagination.
Using extra condensed navigation where only links next and previous pages are available. Useful when there isn't enough space for a full blown pagination.
Paginate data from MySQL:
Paginate data from MySQL in reverse order:
Would result in something like