====== _getListCount ======
{#JAPI Joomla.Framework Application JModel::_getListCount #}
Returns a record count for the specified query.
This method returns an integer specifying the number of records that executing the query returns.
This method is protected and should only be invoked by JModel child classes.
===== Syntax =====
int _getListCount ( **$query** )
| **$query** | string | is a string containing the query for which to retrieve the record count. |
===== Examples =====
jimport( 'joomla.application.component.model' );
class PollModelPoll extends JModel
{
function __construct() {
$config = array(
'table_path' => JPATH_COMPONENT.DS.'tables'
);
parent::__construct( $config );
}
function getDataCount() {
$query = 'SELECT * FROM #__polls';
return $this->_getListCount( $query );
}
}
$model =& JModel::getInstance( 'poll', 'PollModel' );
$data =& $model->getDataCount();
print_r( $data );
might produce
1
----
~~DISCUSSION~~