PHP code example of igorsimdyanov / pager

1. Go to this page and download the library: Download igorsimdyanov/pager 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/ */

    

igorsimdyanov / pager example snippets


$obj = new ISPager\DirPager(
    new ISPager\PagesList(),
    'photos',
    3,
    2
);
echo '<pre>';
print_r($obj->getItems());
echo '</pre>';
echo "<p>$obj</p>";

$obj = new ISPager\FilePager(
    new ISPager\ItemsRange(),
    'largetextfile.txt');
echo '<pre>';
print_r($obj->getItems());
echo '</pre>';
echo "<p>$obj</p>";

try {
    $pdo = new PDO(
        'pgsql:host=localhost;dbname=test',
        'root'
    );
    $obj = new ISPager\PdoPager(
        new ISPager\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";
}