Overview

Namespaces

  • Rundiz
    • Pagination

Classes

  • Pagination
  • Overview
  • Namespace
  • Class

Class Pagination

Set the total number of records, number of displaying items per page, then render the page numbers with links.
This class support to render pages in these styles.
First Previous Next Last
Previous Next
First Previous 1 2 3 4 [5] 6 7 8 9 Next Last
Previous 1 2 3 4 [5] 6 7 8 9 Next
1 2 3 4 [5] 6 7 8 9
First Previous 1 2 ... 4 [5] 6 ... 8 9 Next Last
Previous 1 2 ... 4 [5] 6 ... 8 9 Next
1 2 ... 4 [5] 6 ... 8 9
First Previous 4 [5] 6 ... 8 9 Next Last
Previous 4 [5] 6 ... 8 9 Next
4 [5] 6 ... 8 9
First Previous 1 2 ... 4 [5] 6 Next Last
Previous 1 2 ... 4 [5] 6 Next
1 2 ... 4 [5] 6
Or any custom styles that you can build on your own.

Namespace: Rundiz\Pagination
License: MIT
Author: Vee W.
Located at Pagination/Pagination.php
Methods summary
public
# __construct( )
public
# __destruct( )
public
# clear( )

Clear and reset properties to the default values.

Clear and reset properties to the default values.

public string
# createLinks( string $result_string = 'Displaying page :current_page_number_displaying of :total_pages<br>:pagination' )

Create pagination links and return the html data.

Create pagination links and return the html data.

Parameters

$result_string
The pagination results. Add these place holders for replace with content while generating pages. (:total_pages, :page_number_type, :current_page_number_displaying, :pagination).

Returns

string
Return created pagination links in HTML format.
public array
# getPaginationData( )

Generate the pagination data for render in HTML.
You can call to this method directly if you want to render pagination on your own styles.

Generate the pagination data for render in HTML.
You can call to this method directly if you want to render pagination on your own styles.

Returns

array
Return generated pagination data as array.

Throws

Exception
Throw the errors on failure such as some required property is missing.
Properties summary
public string $base_url

(Required property.) The URL for use when generate page numbers with links. Set the position where page numbers will be appears as URI segment or query string with %PAGENUMBER% placeholder.
Example 1: http://domain.tld/my-category/page/%PAGENUMBER% This URL use page number as URI segment
Example 2: http://domain.tld/my-category?page=%PAGENUMBER% This URL use page number as query string
Example 3: http://domain.tld/my-category?filter=some_filter_values&amp;search=foobar&amp;page=%PAGENUMBER% This URL use page number as query string with other query strings in it, seperate each query string with &amp; not just &.
Example 4: http://domain.tld/my-category?start=%PAGENUMBER% This URL use page number as query string but use start as the name.
You have to get the page number value and set its value to this class by call the "page_number_value" property.

(Required property.) The URL for use when generate page numbers with links. Set the position where page numbers will be appears as URI segment or query string with %PAGENUMBER% placeholder.
Example 1: http://domain.tld/my-category/page/%PAGENUMBER% This URL use page number as URI segment
Example 2: http://domain.tld/my-category?page=%PAGENUMBER% This URL use page number as query string
Example 3: http://domain.tld/my-category?filter=some_filter_values&amp;search=foobar&amp;page=%PAGENUMBER% This URL use page number as query string with other query strings in it, seperate each query string with &amp; not just &.
Example 4: http://domain.tld/my-category?start=%PAGENUMBER% This URL use page number as query string but use start as the name.
You have to get the page number value and set its value to this class by call the "page_number_value" property.

#
public integer $total_records

(Required property.) The total number of records. This means "all" records by conditions with out the "LIMIT" or slices commands.

(Required property.) The total number of records. This means "all" records by conditions with out the "LIMIT" or slices commands.

#
public integer $items_per_page

The number of items that will be displaying per page. Such as number of articles to display in each page.

The number of items that will be displaying per page. Such as number of articles to display in each page.

# 10
public string $page_number_type

The page number type. The value can be start_num or page_num. Start number or start_num. (eg. page number value will be 0, 10, 20, 30, ...) Page number or page_num. (eg. page number value will be 1, 2, 3, 4, ...)
This class cannot detect page number value automatically because of dynamic styles of URL. So, you have to manually set its value to the "page_number_value" property.

The page number type. The value can be start_num or page_num. Start number or start_num. (eg. page number value will be 0, 10, 20, 30, ...) Page number or page_num. (eg. page number value will be 1, 2, 3, 4, ...)
This class cannot detect page number value automatically because of dynamic styles of URL. So, you have to manually set its value to the "page_number_value" property.

# 'start_num'
public integer $page_number_value

(Required property.) The current page number value. This class cannot detect current page number automatically because of dynamic styles of URL. So, you have to manually set its value to this property.

(Required property.) The current page number value. This class cannot detect current page number automatically because of dynamic styles of URL. So, you have to manually set its value to this property.

#
public string $overall_tag_open

The overall tag open. It will be place at the very beginning of displaying page numbers.

The overall tag open. It will be place at the very beginning of displaying page numbers.

# ''
public string $overall_tag_close

The overall tag close. It will be place at the very end of displaying page numbers.

The overall tag close. It will be place at the very end of displaying page numbers.

# ''
public mixed $first_page_text

The link text of the paginate that will go to the first page. Set to false to not displaying first page link.

The link text of the paginate that will go to the first page. Set to false to not displaying first page link.

# '&laquo; First'
public boolean $first_page_always_show

If you are at first page the first page link will not show if you set this value to false, if you set to true it will be always show the first page link.

If you are at first page the first page link will not show if you set this value to false, if you set to true it will be always show the first page link.

# false
public string $first_tag_open

The first page tag open. If you set to display first page, this will be placed before link to the first page.

The first page tag open. If you set to display first page, this will be placed before link to the first page.

# ' '
public string $first_tag_close

The first page tag close. If you set to display first page, this will be placed after link to the first page.

The first page tag close. If you set to display first page, this will be placed after link to the first page.

# ' '
public mixed $last_page_text

The link text of the paginate that will go to the last page. Set to false to not displaying last page link.

The link text of the paginate that will go to the last page. Set to false to not displaying last page link.

# 'Last &raquo;'
public boolean $last_page_always_show

If you are at last page the last page link will not show if you set this value to false, if you set to true it will be always show the last page link.

If you are at last page the last page link will not show if you set this value to false, if you set to true it will be always show the last page link.

# false
public string $last_tag_open

The last page tag open. If you set to display last page, this will be placed before link to the last page.

The last page tag open. If you set to display last page, this will be placed before link to the last page.

# ' '
public string $last_tag_close

The last page tag close. If you set to display last page, this will be placed after link to the last page.

The last page tag close. If you set to display last page, this will be placed after link to the last page.

# ' '
public mixed $next_page_text

The link text of the paginate that will go to the next page. Set to false to not displaying next page link.

The link text of the paginate that will go to the next page. Set to false to not displaying next page link.

# 'Next &rsaquo;'
public boolean $next_page_always_show

If you are at last page the next page link will not show if you set this value to false, if you set to true it will be always show the next page link.

If you are at last page the next page link will not show if you set this value to false, if you set to true it will be always show the next page link.

# false
public string $next_tag_open

The next page tag open. If you set to display next page, this will be placed before link to the next page.

The next page tag open. If you set to display next page, this will be placed before link to the next page.

# ' '
public string $next_tag_close

The next page tag close. If you set to display next page, this will be placed after link to the next page.

The next page tag close. If you set to display next page, this will be placed after link to the next page.

# ' '
public mixed $previous_page_text

The link text of the paginate that will go to the previous page. Set to false to not displaying previous page link.

The link text of the paginate that will go to the previous page. Set to false to not displaying previous page link.

# '&lsaquo; Previous'
public boolean $previous_page_always_show

If you are at first page the previous page link will not show if you set this value to false, if you set to true it will be always show the previous page link.

If you are at first page the previous page link will not show if you set this value to false, if you set to true it will be always show the previous page link.

# false
public string $previous_tag_open

The previous page tag open. If you set to display previous page, this will be placed before link to the previous page.

The previous page tag open. If you set to display previous page, this will be placed before link to the previous page.

# ' '
public string $previous_tag_close

The previous page tag close. If you set to display previous page, this will be placed after link to the previous page.

The previous page tag close. If you set to display previous page, this will be placed after link to the previous page.

# ' '
public boolean $current_page_link

Display current link at current page. Set to true to display, false not to display.

Display current link at current page. Set to true to display, false not to display.

# false
public string $current_tag_open

The current page tag open. If you set to display current page, this will be placed before link to the current page.

The current page tag open. If you set to display current page, this will be placed before link to the current page.

# ' <strong>'
public string $current_tag_close

The current page tag close. If you set to display current page, this will be placed after link to the current page.

The current page tag close. If you set to display current page, this will be placed after link to the current page.

# '</strong> '
public boolean $number_display

Display the page numbers or not. Set to true to display, false not to display.

Display the page numbers or not. Set to true to display, false not to display.

# true
public string $number_tag_open

The page number tag open. If you set to display page number, this will be placed before link to the page number.

The page number tag open. If you set to display page number, this will be placed before link to the page number.

# ' '
public string $number_tag_close

The page number tag close. If you set to display page number, this will be placed after link to the page number.

The page number tag close. If you set to display page number, this will be placed after link to the page number.

# ' '
public integer $number_adjacent_pages

The number of adjacent pages before and after the current page.

The number of adjacent pages before and after the current page.

# 5
public boolean $unavailable_display

Display unavailable page (...) or not. Set to true to display, false to not display.

Display unavailable page (...) or not. Set to true to display, false to not display.

# false
public string $unavailable_text

The unavailable page text. Basically it is something to show that there are pages between these range such as 3 dots text. (...)

The unavailable page text. Basically it is something to show that there are pages between these range such as 3 dots text. (...)

# '&hellip;'
public string $unavailable_tag_open

The unavailable page tag open. If you set to display unavailable page, this will be placed before unavailable page (...).

The unavailable page tag open. If you set to display unavailable page, this will be placed before unavailable page (...).

# ' '
public string $unavailable_tag_close

The unavailable page tag close. If you set to display unavailable page, this will be placed after unavailable page (...).

The unavailable page tag close. If you set to display unavailable page, this will be placed after unavailable page (...).

# ' '
public mixed $unavailable_before

Number of pages to display before first unavailable page. Set number as integer or set to false to not display the pages before unavailable.

Number of pages to display before first unavailable page. Set number as integer or set to false to not display the pages before unavailable.

# 2
public mixed $unavailable_after

Number of pages to display after last unavailable page. Set number as integer or set to false to not display the pages after unavailable.

Number of pages to display after last unavailable page. Set number as integer or set to false to not display the pages after unavailable.

# 2
protected array $temp_properties

Temporary property for store the original properties.

Temporary property for store the original properties.

#
protected integer $total_pages

Total pages that was calculated from total records and items per page. This is for use in programatic only.

Total pages that was calculated from total records and items per page. This is for use in programatic only.

#
API documentation generated by ApiGen