pagination()
protected final function pagination($paginationStyleSettingName, $currentPage, $pages, &$html, &$links = array())
This function allows you to easily create pagination for your Plugins.
Can be used in methods called by plugins. From Zenario 7.0.0 onwards.
This function allows you to use the pagination system that comes with Zenario to create a system of page numbers.
There are two advantages of doing this over using your own pagination logic:
To use this function, you need a Plugin Setting of <type>pagination</type> defined in your Plugin's description.
You then need to provide the function with the name of this function, the current page number, and an array of all possible pages.
$paginationStyleSettingName
The name of a Plugin Setting, where the named Plugin Setting must be a select list with values generated by the paginationOptions() Admin Function.
From 6.0.4 onwards you can also pass a value in directly. Acceptable values are class names and method names separated by two colons; for example:
• tribiq_common_features::pagAll
• tribiq_common_features::pagCloseWithNPIfNeeded
• tribiq_common_features::pagCurrentWithFNPL or
• tribiq_common_features::pagSelectList.
If nothing is entered or your requested class/method does not exist, tribiq_common_features::pagCloseWithNPIfNeeded will be used as a default.
$currentPage
The current page that you are displaying.
This should also appear as one of the keys in $pages.
$pages
An associative array of pages to request strings.
Please note that the keys and values are a different way around than our usual format for Lists of Values. In this case:
The CMS will not do any sorting; you should ensure that entries in this array are ordered in the order you wish them to appear on the page.
$html
The HTML for your pagination will be placed in this variable.
No return value.
<setting> <name>pagination_style</name> <label>Pagination style:</label> <type>pagination</type> <default_value>tribiq_cms_core::pagAllWithNPIfNeeded</default_value> </setting>
$html = '';
$currentPage = ifNull((int) $this->get('page'), 1); $pages =
array( 1 => 'page=1', 2 => 'page=2', 3 => 'page=3');
$this->mergeFields['Pagination'] =
$this->pagination('pagination_style', $currentPage, $pages, &$html);
This simple example will create three pages, named 1, 2 and 3.