API16

JModelList/getItems

From Joomla! Documentation

< API16:JModelList
Revision as of 17:36, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Method to get an array of data items. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Method to get an array of data items.

[Edit Descripton]

Template:Description:JModelList/getItems

Syntax[edit]

getItems()


Returns[edit]

mixed An array of data items on success, false on failure.

Defined in[edit]

libraries/joomla/application/component/modellist.php

Importing[edit]

jimport( 'joomla.application.component.modellist' );

Source Body[edit]

public function getItems()
{
        // Get a storage key.
        $store = $this->_getStoreId();

        // Try to load the data from internal storage.
        if (!empty($this->_cache[$store])) {
                return $this->_cache[$store];
        }

        // Load the list items.
        $query  = $this->_getListQuery();
        $items  = $this->_getList((string) $query, $this->getState('list.start'), $this->getState('list.limit'));

        // Check for a database error.
        if ($this->_db->getErrorNum()) {
                $this->setError($this->_db->getErrorMsg());
                return false;
        }

        // Add the items to the internal cache.
        $this->_cache[$store] = $items;

        return $this->_cache[$store];
}

[Edit See Also] Template:SeeAlso:JModelList/getItems

Examples[edit]

<CodeExamplesForm />