2017 © Pedro Peláez
 

library php-simple-pagination

Simple Pagination Class for PHP

image

klab/php-simple-pagination

Simple Pagination Class for PHP

  • Thursday, September 7, 2017
  • by ha1t
  • Repository
  • 1 Watchers
  • 2 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

php-simple-pagination

install

composer require klab/php-simple-pagination, (*1)

example

 ['id' => 1],
    2 => ['id' => 2],
    3 => ['id' => 3],
    4 => ['id' => 4],
    5 => ['id' => 5],
    6 => ['id' => 6],
    7 => ['id' => 7],
    8 => ['id' => 8],
    9 => ['id' => 9],
];

$items = [];
$current = (int)$_GET['page'];
$count = 3;

if ($current === 1) {
    $items = [
        $db[1],
        $db[2],
        $db[3],
        $db[4],
    ];
} else if ($current === 2) {
    $items = [
        $db[4],
        $db[5],
        $db[6],
        $db[7],
    ];
} else if ($current === 3) {
    $items = [
        $db[7],
        $db[8],
        $db[9],
    ];
} else {
    $current = 1;
    $items = [
        $db[1],
        $db[2],
        $db[3],
        $db[4],
    ];

}

$pagination = new SimplePagination($current, $count);
$pagination->checkLastPage($items);

?>
<html>
<body>


SimplePagination Example

current > 1): ?> <a href='?page=<?php echo $pagination->prev ?>'>Previous</a> Previous <a href="<?php echo $item['id'] ?>"></a>&nbsp; is_last_page): ?> <a href='?page=<?php echo $pagination->next ?>'>Next</a> Next </body> </html>

The Versions

07/09 2017

dev-master

9999999-dev https://github.com/KLab/php-simple-pagination

Simple Pagination Class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2.3

 

by Avatar ha1t

07/09 2017

v1.0.0

1.0.0.0 https://github.com/KLab/php-simple-pagination

Simple Pagination Class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2.3

 

by Avatar ha1t

20/11 2013

dev-support_composer

dev-support_composer

Simple Pagination Class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.2.3

 

by Avatar ha1t