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"

...

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");

...