Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Ergänzung in "How to work with articles in modules"

...

The usage is very simple. You can load single or multiple article objects by using the article Item or ItemCollection instances or you can use the cArticleCollector class - in previous versions of CONTENIDO formerly known as "ArticleCollection".

...

Code Block
languagephp
linenumberstrue
// load language independent article by Item or ItemCollection
$idart = 1;
$article = new cApiArticle($idart);
$articleCol = new cApiArticleCollection();
$article = $articleCol->loadItem($idart);

// load language dependent article by Item or ItemCollection
$idartLang = 1;
$artLang = new cApiArticleLanguage($idartLang);
$artLangColl = new cApiArticleLanguageCollection();
$artLang = $artLangColl->loadItem($idartLang);

//or if no idartlang is available:
$obj = new cApiArticleLanguage();
$obj->loadByArticleAndLanguageId($idart, $lang);
$msgText = $obj->getContent("CMS_HTMLHEAD", 1);
// set online state
$artLang->set("online", 1);
$artLang->store();

// get online state
$artLang->get("online");

...