API15

API15:JPagination/getResultsCounter

From Joomla! Documentation

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