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)
package | Core |
---|---|
subpackage | Helper |
__construct(array $options) : void
If options are defined, the loading process is automatically initiated.
array
array with options for the collector (optional, default: empty array)
count() : int
Returns the amount of all loaded articles.
int
current() : mixed
mixed
key() : int | mixed
int
mixed
loadArticles() : void
\cUnexpectedValueException |
---|
next() : void
rewind() : void
seek(int $position)
setOptions(array $options) : void
Validates incoming options and sets the default of the missing options.
array
array with option
setPage(int $page) : void
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()) { ... }
int
The page of the article collection
setResultPerPage(int $resPerPage) : void
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)
int
startArticle() : \cApiArticleLanguage
Returns the start article of a category. Does work only if one category was requested.
\cBadMethodCallException |
---|
valid() : bool
bool
$_articles : array
$_currentPosition : int
$_pages : array
$_startArticles : array