tt_news
1.3.6. Categories
You can assign categories to news. That allows you to display f.e. only news with a certain category in a "LIST" content-element.
Categories can have parent categories. The category "FrontEnd plugins" in the screenshot below does have category "Extensions" selected as "parent category", so "FrontEnd plugins" is a subcategory of "Extensions". If the use of subcategories for the FrontEnd is enabled the result is, that the news record with category "FrontEnd plugins" from the screenshot will also appear in a LIST that shows only the category "Extensions".
The use of subcategories in the FrontEnd of the website has to be enabled by setting "useSubCategories=1" in the constant editor or directly in TS setup. The display of subcategories can be configured seperatly with the TS var "displaySubCategories". Subcategories can be wrapped with another wrap than normal categories.
Example:
This configures tt_news to use and display subcategories. Only news with the selected categories (23,34) will be displayed. Subcategories will be wrapped with a red border.
plugin.tt_news {
useSubCategories = 1
displaySubCategories = 1
categoryMode = 1
categorySelection = 23,34
displayList {
subCategoryImgItem_stdWrap.wrap = <span style="border:1px solid red;">|</span>
subCategoryTitleItem_stdWrap.wrap = <span style="border:1px solid red;">|</span>
}
}
In the BackEnd the categories are shown in a tree view. Since tt_news 2.5.0 the category tree is expandable and collapsible (requires the extension xajax).
Categories can be created with the "create new record" link like shown in the section "Quickstart", or with the "+"(add) icon directly from the news db record.
Hint:
Editing of categories directly from a news record works only for categories which are assigned to this record record. To edit a category select it in the left category field and click on the edit button (the pencil).
The page where new categories from the "add" wizard will be created depends on the setting of "use General Record storage page" in the extension setup. If you use the "General Record storage page" for categories, all categories will be created in this page. If you disabled "use General Record storage page" all categories from wizards will be created in the current page.
Controlling editing permissions with assigned categories:
It's possible to control the editing permissions for news records with the assigned categories. This is either possible by editing the Tsconfig field of the be_user/group or � since tt_news 2.5.0 � by selecting the allowed/visible categories from a category tree in the be_user/group record. The category tree in be_user records appears only if the user is not admin. In the sreenshot below you see a be_user record where the user is only allowed to edit or assign the category "Commitees" and its subcategories.

If thís user opens a news record he will only see the category "Commitees" and its subcategories.

If a BE-user is restricted to certain categories he can only change news records that have these categories assigned. If he performs any action (move, delete, hide, localize, copy, version, modify) with a record that has non-allowed categories assigned an error message will be displayed and the action will be ignored.

Another message will be displayed in the news record above the fields "Type" and "Category". Non-selectable categories will be displayed in grey text and not linked. See screenshot below. Defining allowed categories is also possible by inserting their uids in the Tsconfig field of a be_user or be_group record.
Example:
(user/group TSconfig)
# this enables the use of the list below
options.useListOfAllowedItems = 1
# users of this group are only allowed to save news records with the following categories:
tt_newsPerms.tt_news_cat.allowedItems = 35,36,37
If the BE-user with this configuration opens a record that has at least one category assigned that is not in the list of allowed items he will see the error message below.

The category rootline
The tt_news html template contains a marker ###NEWS_CATEGORY_ROOTLINE###. This marker will be filled with the titles of the parent categories of the first assigned category in SINGLE view or with the parents of the selected category in LIST view. It doesn't work in LIST view if more than one category is selected.
The category titles can be linked to the category shortcut page which is configured in the category db-record.
plugin.tt_news {
# settings for the category rootline
catRootline {
showCatRootline = 1
catRootline_stdWrap.wrap = <div class="news-catRootline">|</div>
# if titles are linked the link points to the page which is configured as category shortcut
linkTitles = 1
title_stdWrap.wrap =
divider = >
}
}
