Support Joomla!

references:joomla.framework:application:jmodel-_getlistcount

Table of Contents

_getListCount

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Application Class JModel Method _getListCount Reference _getListCount() Never Work in Progress

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

Example

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

Result

1

 
references/joomla.framework/application/jmodel-_getlistcount.txt (454 views) · Last modified: 2007/08/15 14:50