API16

API16:JPagination/getResultsCounter

From Joomla! Documentation

Description

Create and return the pagination result set counter string, ie. Results 1-10 of 42



Syntax

getResultsCounter()


Returns

string Pagination result set counter string.

Defined in

libraries/joomla/html/pagination.php

Importing

jimport( 'joomla.html.pagination' );

Source Body

public function getResultsCounter()
{
        // Initialise 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;
}



Examples

Code Examples