Documentation

Paginator
in package

Helps paginate data to an HTML table easily.

Tags
author

Samerton

author

graphiteisaac

version
2.0.0-pr13
license

MIT

Table of Contents

Properties

$_class  : array<string, string>
$_leftContent  : string
$_limit  : int
$_page  : int
$_rightContent  : string
$_total  : int

Methods

__construct()  : mixed
generate()  : string
Generate HTML for data to be presented with.
getLimited()  : object
Generate object of provided data.
setValues()  : void
Set values of instance variables, alternative function if we don't have all the $data.

Properties

$_class

private array<string, string> $_class

The classes to use for ul, li and a HTML element styling.

$_leftContent

private string $_leftContent

The element to use for the left arrow.

$_limit

private int $_limit

The number of items per page.

$_rightContent

private string $_rightContent

The element to use for the right arrow.

$_total

private int $_total

The total number of items.

Methods

__construct()

public __construct([array<string|int, mixed>|null $class = [] ][, string|null $leftContent = null ][, string|null $rightContent = null ]) : mixed
Parameters
$class : array<string|int, mixed>|null = []

Optional array of class names, if provided the required element keys are ul, li and a

$leftContent : string|null = null

Optional string to display in "previous" button, default «

$rightContent : string|null = null

Optional string to display in "next" button, default »

generate()

Generate HTML for data to be presented with.

public generate(int $links[, string $href = '?' ]) : string
Parameters
$links : int

Number of links to be shown on each page.

$href : string = '?'

URL prefix to use when next page is clicked.

Return values
string

Generated HTML to display in template.

getLimited()

Generate object of provided data.

public getLimited(array<string|int, mixed> $data[, int $limit = 10 ][, int $page = 1 ][, int $total = 10 ]) : object
Parameters
$data : array<string|int, mixed>

Data to paginate.

$limit : int = 10

Number of items per page.

$page : int = 1

Current page.

$total : int = 10

Total number of items.

Return values
object

setValues()

Set values of instance variables, alternative function if we don't have all the $data.

public setValues(int $total, int $limit, int $page) : void
Parameters
$total : int

Total number of items

$limit : int

Number of items per page

$page : int

Current page


        
On this page

Search results