This class contains functions for the article helper in CONTENIDO.

The article collector returns you a list of articles, which destination you can choose.

You have the ability to limit, sort and filter the article list. You can configure the article collector with an options array, which can include the following configuration. - idcat - category ID - categories - array with multiple category IDs - lang - language ID, active language if ommited - client - client ID, active client if ommited - artspecs - array of article specifications, which should be considered - offline - include offline article in the collection, defaults to false - offlineonly - only list offline articles, defaults to false - start - include start article in the collection, defaults to false - startonly - only list start articles, defaults to false - order - articles will be ordered by this property, defaults to created - direction - order direcion, ASC'or DESC for ascending/descending, defaults to DESC - limit - limit numbers of articles in collection, default to 0 (unlimited)

deprecated [2012-10-22] This class is deprecated. Use cArticleCollector instead. CONTENIDO API - Article Object Collection. This class is used to manage multiple CONTENIDO article objects in a collection. The constructor awaits an associative array as parameter with the following schema: array( string paramname => mixed value ); The parameter idcat is required: array('idcat'=>n) Legal parameter names are: idcat - CONTENIDO Category Id lang - Language Id, active language if ommited client - Client Id, active client if ommited start - include start article in the collection, defaults to false artspecs - Array of article specifications, which should be considered order - articles will be orderered by this article property, defaults to 'created' direction - Order direcion, 'asc' or 'desc' for ascending/descending, defaults to 'asc' limit - Limit numbers of articles in collection You can easy create article lists/teasers with this class. To create an article list of category 4 (maybe a news category) use: $myList = new ArticleCollection(array("idcat"=>4); while ($article = $myList->nextArticle()) { // Fetch the first headline $headline = $article->getContent('htmlhead', 1); $idart = $article->getField('idart'); // Create a link echo ''.$headline.'
'; }
package Core

 Methods

ArticleCollection()

ArticleCollection($options) 
deprecated [2011-03-15] Old constructor function for downwards compatibility

Parameters

$options

Constructor.

__construct(array $options) : void

If options are defined, the loading process is automatically initiated.

deprecated [2012-10-22] This class is deprecated. Use cArticleCollector instead.

Parameters

$options

array

array with options for the collector (optional, default: empty array)

Method "count" of the implemented Countable interface.

count() : int
Inherited

Returns the amount of all loaded articles.

inherited_from \cArticleCollector::count()

Returns

int

Method "current" of the implemented iterator.

current() : mixed
Inherited
inherited_from \cArticleCollector::current()

Returns

mixed

Method "key" of the implemented iterator.

key() : int | mixed
Inherited
inherited_from \cArticleCollector::key()

Returns

intmixed

Executes the article search with the given options.

loadArticles() : void
Inherited
inherited_from \cArticleCollector::loadArticles()

Exceptions

\cUnexpectedValueException

Method "next" of the implemented iterator.

next() : void
Inherited
inherited_from \cArticleCollector::next()

Compatibility method for old ArticleCollection class.

nextArticle() : bool | \cApiArticleLanguage
Inherited

Returns the next article.

inherited_from \cArticleCollector::nextArticle()

Returns

Method "rewind" of the implemented iterator.

rewind() : void
Inherited
inherited_from \cArticleCollector::rewind()

Seeks a specific position in the loaded articles.

seek(int $position) 
Inherited
inherited_from \cArticleCollector::seek()

Parameters

$position

int

position to load

Exceptions

\cOutOfBoundsException

Setter for the collector options.

setOptions(array $options) : void
Inherited

Validates incoming options and sets the default of the missing options.

inherited_from \cArticleCollector::setOptions()

Parameters

$options

array

array with option

Compatibility method for old ArticleCollection.

setPage(int $page) : void
Inherited

Select a page if the results was divided before.

$collection->setResultPerPage(2); $collection->setPage(1);

// Iterate through all articles of page two while ($art = $collection->nextArticle()) { ... }

inherited_from \cArticleCollector::setPage()

Parameters

$page

int

The page of the article collection

Compatibility method for old ArticleCollection.

setResultPerPage(int $resPerPage) : void
Inherited

Split the article results into pages of a given size.

Example: Article Collection with 5 articles

[0] => 250 [1] => 251 [2] => 253 [3] => 254 [4] => 255

$collection->setResultPerPage(2)

Would split the results into 3 pages

[0] => [0] => 250 [1] => 251 [1] => [0] => 253 [1] => 254 [2] => [0] => 255

A page can be selected with $collection->setPage(int page)

inherited_from \cArticleCollector::setResultPerPage()

Parameters

$resPerPage

int

Compatibility method for old ArticleCollection class.

startArticle() : \cApiArticleLanguage
Inherited

Returns the start article of a category. Does work only if one category was requested.

inherited_from \cArticleCollector::startArticle()

Exceptions

\cBadMethodCallException

Returns

Method "valid" of the implemented iterator.

valid() : bool
Inherited
inherited_from \cArticleCollector::valid()

Returns

bool

 Properties

 

$_articles : array
Inherited
inherited_from \cArticleCollector::$$_articles
 

$_currentPosition : int
Inherited
inherited_from \cArticleCollector::$$_currentPosition
 

$_options : array
Inherited
inherited_from \cArticleCollector::$$_options
 

$_pages : array
Inherited
inherited_from \cArticleCollector::$$_pages
 

$_startArticles : array
Inherited
inherited_from \cArticleCollector::$$_startArticles