Class Pagination
Provides helper methods for dealing with HTML content
-
Html
-
Pagination
Methods summary
public
|
#
__construct( array $get = array(), array $format = array() )
Sets default settings
Parameters
- $get
array $get The GET parameters for the current request
- $format
array $format Format settings to overwrite default settings with (optional)
|
private
array
|
#
mergeArrays( array $arr1, array $arr2 )
Extends one array using another to overwrite existing values. Recursively
merges data.
Extends one array using another to overwrite existing values. Recursively
merges data.
Parameters
- $arr1
array $arr1 The array (default) to be merged into
- $arr2
array $arr2 The array to merge into $arr1
Returns
array The merged arrays
|
public
|
#
setGet( array $get )
Set all GET parameters for this pagination instance
Set all GET parameters for this pagination instance
Parameters
- $get
array $get An array of GET parameters
|
public
|
#
setEol( string $eol )
Sets the end of line character to use
Sets the end of line character to use
Parameters
- $eol
string $eol The end of line character to use
|
public
|
#
setSettings( array $format )
Sets the format settings
Parameters
- $format
array $format The format settings to overwrite
|
public
string
|
#
build( )
Builds the content of the pagination and optionally outputs it.
Builds the content of the pagination and optionally outputs it.
Returns
string The HTML for the pagination, void if output enabled
|
private
integer
|
#
currentPage( )
Finds the current page based on the current URI and/or query parameters
Finds the current page based on the current URI and/or query parameters
Returns
integer The current page
|
private
string
|
#
createNavItem( array $nav_item, string $page )
Creates a page nav item
Parameters
- $nav_item
array $nav_item Navigation settings for a specific nav link
- $page
string $page The page number or symbol
Returns
string The HTML for the nav item, void if output enabled
|
private
string
|
#
openTag( array $tag )
Opens a new tag
Parameters
- $tag
array $tag The tag setting to open
Returns
string The HTML for an open tag, void if output enabled
|
private
string
|
#
closeTag( string $tag )
Closes a tag
Parameters
- $tag
string $tag The tag setting to close
Returns
string The HTML for a closing tag, void if output enabled
|
private
string
|
#
createLink( array $link, integer $page )
Creates a new link
Parameters
- $link
array $link The link settings
- $page
integer $page The page number
Returns
string The HTML for the <a> tag, void if output enabled
|
private
|
|
public
string
|
#
getPageUri( integer $page )
Create the URI for the current page number, replacing any labels as
needed.
Create the URI for the current page number, replacing any labels as
needed.
Parameters
- $page
integer $page The page number
Returns
string The completed URI
|
public
|
#
setOutput( boolean $return )
Set whether to return $output generated by these methods, or to echo it out
instead
Set whether to return $output generated by these methods, or to echo it out
instead
Parameters
- $return
boolean $return True to return output from these form methods, false to echo results
instead
|
private
string
|
#
output( string $html )
Handles whether to output or return $html
Handles whether to output or return $html
Parameters
- $html
string $html The HTML to output/return
Returns
string The HTML given, void if output enabled
|
Methods inherited from Html
_()
,
addCondition()
,
buildAttributes()
,
concat()
,
hyperlink()
,
ifSet()
,
isUtf8()
,
safe()
Magic methods summary
Properties summary
private
string
|
$eol |
#
The string to use as the end of line character
The string to use as the end of line character
|
private
boolean
|
$return_output |
#
Whether or not to return output from various pagination methods
Whether or not to return output from various pagination methods
|
private
array
|
$settings |
|
private
array
|
$get |
#
All get parameters for this request
All get parameters for this request
|
Properties inherited from Html
$xhtml