SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 301 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


The getTotal() method is a method that we must define in order to use. We don't
have to use this name or this mechanism to determine the total number of items. This
is an example of how we might implement the getTotal() method:
/**
* Get number of items
*
* @access public
* @return integer
*/
function getTotal()
{
Rendering Output
[ 226 ]
if (empty($this->_total))
{
$query = $this->_buildQuery();
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}
This method uses the private method _buildQuery() to get the query that we use to
get the data. This is the same method as the model's getData() method is likely to
be using. We then use the private method _getListCount() to count the number of
results that will be returned from the query.
The _getListCount() method is defined in the JModel class.
Moving on to our use of $limit and $limitstart, we use the getState() method.
JModel objects store a state object in order to record the state of the model. It is
common to use the state variables limit and limitstart to record the list limit and
start position.


Pages:
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6