cArticleCollector
The class cArticleCollector provides an easy way to get an iterable array of articles that all share certain characteristics.
Its constructor expects an array of options to filter out articles:
Key | Type | Default value | Description |
---|---|---|---|
idcat | int | none | ID of the category that all results should belong to |
categories | array | none | Array of category ID's. If this and idcat are omitted the class will load all articles regardless of category |
lang | int | current language ID | Language of the articles as ID |
client | int | current client ID | Client of the articles as ID |
artspecs | array | none | Array of Article Specification IDs. The article must have one of those to match. |
offline | boolean | false | Include offline articles |
offlineonly | boolean | false | Only return offline articles |
start | boolean | false | Include start articles |
startonly | boolean | false | Only return start articles |
order | string | "created" | Column that the result should be sorted after |
direction | string | "DESC" | "ASC" or "DESC" depending on if you want the sorting to be ascending or descending. |
limit | int | 0 | A limit on how many articles are going to be loaded 0 means that there is no limit |
Examples
// Get all articles of this client and language that are offline and print their titles $collector = new cArticleCollector(array( "offlineonly" => true )); Â foreach($collector as $article) { echo($article->get("title") . "<br>"); }
Â
You can find out more about this class in the API documentation.