Subcategories
Modify Templates
- Ensure that you are using Article Manager 1.37 or later (upgrade docs)
- Add templatecells to templates/category_list.html for each level of depth you want to use (see "Template Changes" below)
- Make sure templates/category_breadcrumb.html defines how you want breadcrumbs to appear
- In other templates (i.e. templates/index/default.html or templates/article/default.html) replace $cat_name$ with $cat_breadcrumb$ where you want breadcrumb displayed instead of cat_name
Configure Setup Options
- Locate the subcategory settings under Setup Options : Server.
- Decide what you want for "Subcategory Indexing"
- Choose a subcategory format
- Set the "Max subcategory Depth"
|
Subcategories are configured in Setup Options : Server
section. From there you can enable or disable "Subcategory Indexing",
which determines if articles are listed in the indexes of their "parent"
(higher level) categories, set the Maximum Depth of subcategories, and select the format for Subcategories published into the Category List (menubar, for most sites).
config.ini
There are additional subcategory options in the exec/config.ini file. See the config.ini documentation for more info.
Subcategory Format
Format is selected from Article Manager's Setup Options : Server section.
Terminology
Parent/Child -
Any category that has subcategories within it is referred to as a "parent", and the subcategories of that category are its "children".
Selected Category - A category is considered "selected" when you are on the category's index page or on an article page that belongs to that category.
There are five styles for publishing Subcategories, described below. You can experiment with the different formats by selecting one of the options and hitting "Publish All".
- Show All - All categories and subcategories are visible (recommended)
Your Category List will show all categories, regardless of depth.
In many situations, this is the preferred style. If you have a lot
of categories, particularly deep subcategories, you'll probably want
to experiment with the other styles.
- One Level - Always show 1st level categories and allow users to navigate deeper
This style will hide all categories below 1st level unless a
category is selected. The selected category will show its parents,
its children, and the children of its parents, allowing for a drill
down design with some useful context.
- Two Level - Show 1st and 2nd level categories and allow users to navigate deeper
This style will hide categories below level 2 unless a category
is selected. The selected category will show its parents, its
children, and the children of its parents, allowing for a drill
down design with some useful context, but with 1st and 2nd level
categories always visible.
- Selected Branch Only - Only show parents and subcategories of the selected category.
With no selected category, all top level categories will be
visible. When a category is selected, that category will be visible,
along with its parents and children, but all others will not be visible.
- Subcategories Only - Only show subcategories of the selected category (advanced).
Selecting this option will show only subcategories of the
selected category - the category itself and its children will not
be visible. This can be used to provide a "link directory" style
navigation, using the category breadcrumb to navigate back up.
Template Changes: templates/category_list.html
In version 1.36 and before there were three templatecell rows, one
unnamed to publish the categories into the navigation, "selected" (with
different formatting for the "current" category), and "not found"
(published when you have no categories).
With the addition of subcategories in version 1.37, the row
templatecells now use the suffix _depth#
suffix (where # is the depth of the category). The
_depth# suffix allows you to distinguish
parent categories from subcategories. This allows you to use different
formatting for parent categories (a depth of 1) than you would use for
the parent's subcategories (a depth of 2).
Sample templates/category_list.html Code
For example, the following templatecells will publish top level categories with a font size of 3 and publish their immediate subcategories with a font size of 2 and a "--" prefix:
<!-- templatecell : row_depth1 -->
<a href="$url_index$" ><font size=3>$cat_name$</a><br>
<!-- /templatecell : row_depth1 -->
<!-- templatecell : row_depth2 -->
<a href="$url_index$" ><font size=2> -- $cat_name$</a><br>
<!-- /templatecell : row_depth2 -->
<!-- templatecell : row_selected_depth1 -->
<a href="$url_index$" ><font size=3>$cat_name$</a><br>
<!-- /templatecell : row_selected_depth1 -->
<!-- templatecell : row_selected_depth2 -->
<a href="$url_index$" ><font size=2> -- $cat_name$</a><br>
<!-- /templatecell : row_selected_depth2 -->
The "row_selected_depth#" cells are used for outputting the currently "selected" category.
The default templates include up to depth3. If you want to set your "Max Subcategory Depth" to 4 or higher (see Server Options -> Subcategory Settings), you'll need to add templatecells for row_depth4 and row_selected_depth4, or all the way up to the maximum depth you want.
|