Back to ListModel class

Method getStart

public int
getStart
()
Method to get the starting number of items for the data set.
Returns
  • int The starting number of items available in the data set.
Since
  • 1.6
Class: ListModel
Project: Joomla

Method getStart - Source code

/**
 * Method to get the starting number of items for the data set.
 *
 * @return  integer  The starting number of items available in the data set.
 *
 * @since   1.6
 */
public function getStart()
{
    $store = $this->getStoreId('getstart');
    // Try to load the data from internal storage.
    if (isset($this->cache[$store])) {
        return $this->cache[$store];
    }
    $start = $this->getState('list.start');
    if ($start > 0) {
        $limit = $this->getState('list.limit');
        $total = $this->getTotal();
        if ($start > $total - $limit) {
            $start = max(0, (int) (ceil($total / $limit) - 1) * $limit);
        }
    }
    // Add the total to the internal cache.
    $this->cache[$store] = $start;
    return $this->cache[$store];
}