Applied categories
The full list of categories can be filtered to include only those that contain live and visible content. This functionality is especially useful when building navigation for use on the website.
## Single table
To filter the list of categories to those used in a single content type, the filterCategoriesInUse
function is used.
include_once 'JaduAppliedCategories.php';
$categories = filterCategoriesInUse($allCategories, DOCUMENTS_APPLIED_CATEGORIES_TABLE, true);
## Combining multiple tables
This is done using the filterCategoriesInUseFromMultipleTables
function, as shown below.
include_once 'JaduAppliedCategories.php';
$columnRootCategories = filterCategoriesInUseFromMultipleTables($allRootCategories, array(DOCUMENTS_APPLIED_CATEGORIES_TABLE, HOMEPAGE_APPLIED_CATEGORIES_TABLE), true);
## Rebuilding applied categories
If content is updated directly in the database its possible that the applied categories table will get out of sync with the current state of your content.
Where this happens the applied categories state can be updated using the resetAppliedCategories.php
form in the maintenance
directory.