1. Go to this page and download the library: Download webanatorly/pagination library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
webanatorly / pagination example snippets
php
$obj = new Pagination\DirPager(
new Pagination\PagesList(),
'photos',
3,
2);
echo "<pre>";
print_r($obj->getItems());
echo "</pre>";
echo "<p>$obj</p>";
php
$obj = new Pagination\FilePager(
new Pagination\ItemsRange(),
'largetextfile.txt');
echo "<pre>";
print_r($obj->getItems());
echo "</pre>";
echo "<p>$obj</p>";
php
try {
$pdo = new PDO(
'mysql:host=localhost;dbname=test',
'root',
'',
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
$obj = new Pagination\PdoPager(
new Pagination\ItemsRange(),
$pdo,
'table_name');
echo "<pre>";
print_r($obj->getItems());
echo "</pre>";
echo "<p>$obj</p>";
}
catch (PDOException $e) {
echo "Can't connect to database";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.