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"
Excerpt
An article represents a is actually the page of your website.
Info
titleIncomplete
More information will come soonthe website and belongs to one client.

Important article IDs

IDDescription
idartis the article identifier for the client in all languages
idartlangis the client article identifier for dirrerent languages (available through table art_lang)
idcatartis the relation id from category to article (available througt table cat_art)

The tables are referenced by foreign key relation (see below).

Image Added

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".

To see all possible loading and object handling methods, take a look on Item or ItemCollection classes.

With set and get methods you can change all table properties and the store it like in example below.

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

Article states

Language dependent articles have some important states which are commom used during development. These states are stored in the databae table art_lang.

StateDescription
onlineIf article is online, it can be reached from frontend
Example: It is important if you generate link to article or doing something else, you should check that article is online, otherwise it won't be found and you will be redirected to the home or error page
publishedIf article is published it can be reached from frontend
lockedIf article is locked, it can't be accessed or changed from other users in CONTENIDO backend
searchableIf article is searchable, it can be found through CONTENIDO search
redirectIf redirect is active, browser will follow the redirection url instead of loading current article

Furthermore, an article can be defined as a start article of a category. If set so, it will be displayed if the category is accessed without any article information. The ID of the language dependent article as a start article for a category is defined in cat_lang.startidartlang.