2017 © Pedro Peláez
 

library paginator

php paginator

image

hatsunyan/paginator

php paginator

  • Thursday, June 22, 2017
  • by Hatsu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

php paginator

created ul list links for paginations, (*1)

demo
https://hatsunyan.github.io/paginator/
css from demo
https://hatsunyan.github.io/paginator/paginator.css, (*2)

Usage

Simple usage

$paginator = new \Hatsunyan\Paginator();
$paginator->setPages(300,10,15)->setLang('en')->setUrlPattern('/news/{p}')->render();

methods

setPages set pages numbers for calc, (*3)

$paginator->setPages(100, 10, 5);
// you can use constructor
$paginator = new \Hatsunyan\Paginator(100, 10, 5);

setCurrentPage default = 1;, (*4)

$paginator->setsetCurrentPage($page);
// you can use constructor or method setPages

setUrlPattern Set patternt url, use {p} as number of page. default = '/{p}', (*5)

example, (*6)

- '/news/{p}'
- '?page={p}'
- '/posts/{p}/category/5'

```php $paginator->setUrlPattern('/page/{p}');, (*7)

**showNextPrev**
set false to disable. default = true
```php
$pagitaror->showNextPrev(false);

showLastFirst set false to disable. default = true, (*8)

$pagitaror->showLastFirst(false);

setUlClass set ul class use for style. default = paginator, (*9)

$paginator->setUlClass('custom-paginator');

setActivePageClass set active page class use for style. default = active, (*10)

$paginator->setUlClass('custom-active');

render echo completed html, (*11)

$parinator->render();

getHtml return completed html, (*12)

$html = $paginator->getHtml();
echo $html;
//items html
echo $html;

setMaxItems max items created without next/prev/first/last/current, must be even, or be incremented. default = 6, (*13)

$paginator->setMaxItems(8)

useUlWrapper output html style if true all link inside in ul list or just list of a tags default true, (*14)

$paginator->useUlWrapper(false);

refreshHtml set created html to null and u can create html again with new settings like a class or without ul wrap, (*15)

$paginator->useUlWrapper(false);
$htmlWithUlWprap = $paginator->getHtml();
$paginator->refreshHtml()->useUlWrapper(true);
$htmlWithoutUlWprap = $paginator->getHtml();

setLang set language. en|ru|arrows. arrows - use "»" instead text. default = 'ru', (*16)

$paginator->setLang('en');

setCustomLang you can set any lang if you want, (*17)

// first parameter flrst and last title
// second parametr next and prev titile
$paginator->setCustomLang(['start','end'],['back','forward']);
// you can use string to set both title
$paginator->setCustomLang(['start','end'],'...'); //now next and prev have title '...'
// you can use already setted langs
$paginator->setCustomLang('en','arrows');

The Versions

22/06 2017

dev-master

9999999-dev

php paginator

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Hatsunyan

page pagination paginator