Pagify
Pagify is a PHP library for creating pagination links for a collection of objects.
Example usage:
$pagify = new Pagify();
$config = array(
'total' => 30,
'url' => 'posts/page/',
'page' => 2,
'per_page' => 5
);
$pagify->initialize($config);
echo $pagify->get_links();`
This example would output:
Options
Option | Default | Description |
---|---|---|
per_page | 5 | The number of objects on a page. |
total | 0 | The total number of objects. Be sure to set this! |
page | 1 | The current page |
range | 3 | The number of number links to show on either side of the current page. |
url | The url for the link elements. The page number for each link will be appended to the end of this url. | |
show_prev_next | TRUE | Should previous and next links be output by get_links()? |
show_first_last | TRUE | Should first and last links be output by get_links()? |
show_numbers | TRUE | Should number links be output by get_links()? |
separator | (space) | The string that should be used between links. |
tag_open | <div class="pagination"> | Opening tag of HTML used to wrap the pagination links from get_links(). |
tag_close | </div> | Closing tag of HTML used to wrap the pagination links from get_links(). |
prev_link_text | < | Text for the "previous" link. |
prev_link_tag_open | <span id="prev_link"> | Opening tag of HTML used to wrap the "previous" link. |
prev_link_tag_close | </span> | Closing tag of HTML used to wrap the "previous" link. |
next_link_text | > | Text for the "next" link. |
next_link_tag_open | <span id="next_link"> | Opening tag of HTML used to wrap the "next" link. |
next_link_tag_close | </span> | Closing tag of HTML used to wrap the "next" link. |
first_link_text | first | Text for the "first" link. |
first_link_tag_open | <span id="first_link"> | Opening tag of HTML used to wrap the "first" link. |
first_link_tag_close | </span> | Closing tag of HTML used to wrap the "first" link. |
last_link_text | last | Text for the "last" link. |
last_link_tag_open | <span id="last_link"> | Opening tag of HTML used to wrap the "last" link. |
last_link_tag_close | </span> | Closing tag of HTML used to wrap the "last" link. |
num_link_tag_open | (nothing) | Opening tag of HTML used to wrap the num links |
num_link_tag_close | (nothing) | Closing tag of HTML used to wrap the num links |
current_page_link_tag_open | <strong> | Opening tag of HTML used to wrap the current page link |
current_page_link_tag_close | </strong> | Closing tag of HTML used to wrap the current page link |