Change pagination menu
From Osclass Enterprise
Pagination menu can be customized in several ways. There're a few functions very handy for this.
Contents
osc_search_pagination()
This function add the default zero-configuration pagination for the search pages.
osc_comments_pagination()
This function add the default zero-configuration pagination for the item's comments pages.
osc_pagination()
This is the base function. Previous functions call internally this function. If no-parameter is passed it's the same as osc_search_function.
Parameters
- 'total' => number of total pages (default osc_search_total_pages())
- 'selected' => number of the page selected (starting at 1) (default osc_search_page()) Note: In version prior 3.0 it starts at 0
- 'class_first' => css class for the first link (default 'searchPaginationFirst')
- 'class_last' => css class for the last link (default 'searchPaginationLast')
- 'class_prev' => css class for the prev link (default 'searchPaginationPrev')
- 'class_next' => css class for the next link (default 'searchPaginationNext')
- 'text_first' => text for the first link ('<<', 'First', ...) (default '«')
- 'text_prev' => text for the first link ('<', 'Previous.', ...) (default '»')
- 'text_next' => text for the first link ('>', 'Next', ...) (default '<')
- 'text_last' => text for the lastst link ('>>', 'Last', ...) (default '>')
- 'class_selected' => css class for the selected link (default 'searchPaginationSelected')
- 'class_non_selected' => css class for non selected links (default 'searchPaginationNonSelected')
- 'delimiter' => delimiter between links (default " ")
- 'force_limits' => Always show the first/last links even if you're already on first/last page (default false)
- 'sides' => How many pages to show (default 2)
- 'url' => Format of the URL of the links, put "{PAGE}" on the page variable. Example http://www.example.com/index.php?page=search&sCategory=2&iPage={PAGE} (default osc_update_search_url(array('iPage' => '{PAGE}'))
- 'nofollow' => add nofollow to the pagination links (default value: true) Note: Added in v3.0
HTML Structure
Note: v3.0 or higher The html structure of the pagination is the following one:
<ul> <li><span class="searchPaginationSelected list-first">1</span></li> <li><a rel="nofollow" href="http://domain.tld/category/2" class="searchPaginationNonSelected">2</a></li> <li><a rel="nofollow" href="http://domain.tld/category/3" class="searchPaginationNonSelected">3</a></li> <li><a rel="nofollow" href="http://domain.tld/category/4" class="searchPaginationNext">4</a></li> <li><a rel="nofollow" href="http://domain.tld/category/5" class="searchPaginationLast list-last">5</a></li> </ul>