JModelList/getTotal: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 56: | Line 56: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getTotal | category=getTotal | ||
category=JModelList | category=JModelList | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 00:58, 25 March 2017
Description
Method to get the total number of items for the data set.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
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];
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples