The hPagination.php helper provides a set of functions to generate dynamic pagination links for various parts of your Osclass site, including search results, comments, and generic listings. It offers flexible configuration via an associative array of parameters, which lets you customize CSS classes, link texts, URL formats, and the overall pagination behavior. Additionally, there are specialized functions for the admin panel and for displaying result ranges.
osc_search_pagination() – Gets the pagination links for search pagination.
osc_comments_pagination() – Gets the pagination links for comments pagination.
osc_pagination($params = null) – Gets generic pagination links.
This function generates pagination links for search results. It checks whether a custom search URI is available:
View::newInstance()->_exists('search_uri')), the function sets:
url – The base URL concatenated with the search URI and a {PAGE} placeholder.first_url – The base URL concatenated with the search URI (without the page variable).first_url using osc_update_search_url(array('iPage' => null)).A new Pagination instance is created with these parameters, and the function returns the generated pagination links.
This function builds pagination links for comments on an item. It first checks whether pagination is needed by verifying:
osc_comments_per_page()) is 0,osc_item_comments_page() is "all", orosc_item_total_comments()) is less than or equal to the comments per page.If any of these conditions are true, it returns an empty string. Otherwise, it calculates the total number of pages using ceil(osc_item_total_comments()/osc_comments_per_page()), builds a parameters array with:
total – Total pagesselected – Current comment pageurl – URL template generated by osc_item_comments_url('{PAGE}')A Pagination instance is then created with these parameters, and its output is returned.
This generic pagination function accepts an optional associative array $params that customizes its behavior. The available parameter keys are:
osc_search_total_pages()).osc_search_page()).{PAGE} placeholder (default: osc_update_search_url(array('iPage' => '{PAGE}'))).osc_update_search_url(array('iPage' => null))).The function creates a new Pagination instance using these parameters and returns the output of doPagination().
This function is used in the admin panel to display pagination links. It expects an associative array $aData containing:
The function calculates the total number of pages by dividing iTotalDisplayRecords by iDisplayLength (using ceil()), and builds a parameters array with:
&iPage={PAGE}.It then renders a form that allows manual page input and outputs the pagination links.
This function returns a descriptive string indicating the range of results currently being displayed. The parameters include:
If $total is provided and greater than $filtered, the function returns a string formatted as: "Showing from to to of filtered results (filtered from total total results)". Otherwise, it returns: "Showing from to to of filtered results".