Actions

API16

JModelList/getTotal

From Joomla! Documentation

< API16:JModelList
Revision as of 17:36, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Method to get the total number of items for the data set.

[Edit Descripton]

Description:JModelList/getTotal

Syntax

getTotal()


Returns

integer The total number of items available in the data set.

Defined in

libraries/joomla/application/component/modellist.php

Importing

jimport( 'joomla.application.component.modellist' );

Source Body

public function getTotal()
{
        // Get a storage key.
        $store = $this->_getStoreId('getTotal');
 
        // Try to load the data from internal storage.
        if (!empty($this->_cache[$store])) {
                return $this->_cache[$store];
        }
 
        // Load the total.
        $query = $this->_getListQuery();
        $total = (int) $this->_getListCount((string) $query);
 
        // Check for a database error.
        if ($this->_db->getErrorNum()) {
                $this->setError($this->_db->getErrorMsg());
                return false;
        }
 
        // Add the total to the internal cache.
        $this->_cache[$store] = $total;
 
        return $this->_cache[$store];
}

[Edit See Also] SeeAlso:JModelList/getTotal

Examples

<CodeExamplesForm />