Actions

API15

JPagination/getResultsCounter

From Joomla! Documentation

< API15:JPagination
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

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

<CodeExamplesForm />