JPagination/getResultsCounter: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 53: | Line 53: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getResultsCounter | category=getResultsCounter | ||
category=JPagination | category=JPagination | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:00, 25 March 2017
Description
Create and return the pagination result set counter string, ie. Results 1-10 of 42
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
getResultsCounter()
Returns
string Pagination result set counter string
Defined in
libraries/joomla/html/pagination.php
Importing
jimport( 'joomla.html.pagination' );
Source Body
function getResultsCounter()
{
// Initialize variables
$html = null;
$fromResult = $this->limitstart + 1;
// If the limit is reached before the end of the list
if ($this->limitstart + $this->limit < $this->total) {
$toResult = $this->limitstart + $this->limit;
} else {
$toResult = $this->total;
}
// If there are results found
if ($this->total > 0) {
$msg = JText::sprintf('Results of', $fromResult, $toResult, $this->total);
$html .= "\n".$msg;
} else {
$html .= "\n".JText::_('No records found');
}
return $html;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples