2017 © Pedro Peláez
 

library pagination-allegri

simple pagination class

image

hilmanrdn/pagination-allegri

simple pagination class

  • Thursday, December 15, 2016
  • by hilmanrdn
  • Repository
  • 1 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

pagination-allegri

php pagination package, work with search query, (*1)

Install via composer

composer require "hilmanrdn/pagination-allegri":"dev-master"

URL Example

index.php?page=1 //normal
index.php?page=1&search=john&col=username //with search
Search value :will be what we're searching for
Col value :will be which column (on our database), (*2)

How to use it

use PaginationAllegri\Pagination;
require_once 'vendor/autoload.php';

//put your database config as parameter
$pagination = new Pagination($host, $dbname, $user, $pass, $table);

//example here user data
$users = $pagination->get_data(); //all user data
$pages = $pagination->get_numbers(); //total page numbers

var_dump($users); //retreive all users data

//pagination
 for ($i=1; $i
    <? if($pagination->is_showable($i)): ?>
        <a class="<?=$pagination->is_active_page($i); ?>"
           href="?page=<?=$i . '' .$pagination->get_search_param() ?>">
            <?=$i ?>
        </a>
    <? endif; ?>
 endfor; ?>

//previous page
<a href="?page=<?=$pagination->prev_page() . '' .$pagination->get_search_param()?>"> << </a>

//next page
<a href="?page=<?=$pagination->next_page() . '' .$pagination->get_search_param()?>"> >> </a>

The Versions

15/12 2016

dev-master

9999999-dev

simple pagination class

  Sources   Download

The Requires

  • php >=5.3.0

 

by Hilman Ramadhan