| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Application |
JModel |
_getListCount |
_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.
int _getListCount ( $query )
| $query | string | is a string containing the query for which to retrieve the record count. |
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