Category

A category is the logical division of the website and belongs to one client.

Each category may contain one or more articles related to the same topic of your website. A category exists always as a language independent entry in database table cat and as a language dependent entry in table cat_lang.

Important category IDs

IDDescription
idcatis the category identifier for the client and is the same in all languages
idcatlangis the category identifier in different languages (available through table cat_lang)
idcatartis the relation id from category to article (available througt table cat_art)

How to work with categories in modules

The usage is very simple. You can load single or multiple category objects by using category respectively category collection. To see all possible loading and object handling methods, take a look on Item or ItemCollection classes.

// loading a category item
$category = new cApiCategory($idcat);

// loading a category item via collection
$categoryCol = new cApiCategoryCollection();
$category = $categoryCol->loadItem($idcat);

// loading a category language item
$categoryLang = new cApiCategoryLanguage($idcatlang);

// loading a category language item via collection and set visible = 1
$categoryLangCol = new cApiCategoryLanguageCollection();
$categoryLang = $categoryLangCol->loadItem($idcatlang);
$categoryLang->set('visible', 1);
$categoryLang->store();
 
// loading a category article object
$categoryArt = new cApiCategoryArticle($idcatArt);

$categoryArtColl = new cApiCategoryArticleCollection();
$categoryArt = $categoryArtColl->loadItem($idcatArt);

Language dependent category states

Language dependent category objects have different useful states. These states are stored in the databae table cat_lang.

StateDescription
visibleIf a category is visible its online. This means it can be accessed via frontend of the page.
publicIf a category is public then its not protected through CONTENIDO frontend permissions.

 

Â