The Movable Type User Manual

NOTE: This documentation is for Movable Type 3.2. If you are using a newer version, please see the documentation for Movable type 3.3x or Movable Type Enterprise.

« SpamLookup | Up | System »

Chapter Subcategory

In this section:


A specialized version of MTEntries that is aware of subcategories. The difference between the two tags is the behavior of the category attribute.

Attributes:

  • category - The value of this attribute is a category label. This will include any entries to that category and any of its subcategories.

    Since it is possible for two categories to have the same label, you can specify one particular category by including its ancestors, separated by slashes. For instance if you have a category "Flies" and within it a subcategory labeled "Fruit", you can ask for that category with category="Flies/Fruit". This would distinguish it from a category labeled "Fruit" within another called "Food Groups", for example, which could be identified using category="Food Groups/Fruit".

    If any category in the ancestor chain has a slash in its label, the label must be quoted using square brackets: category="Beverages/[Coffee/Tea]" identifies a category labeled Coffee/Tea within a category labeled Beverages.

You can also use any of the other attributes available to MTEntries; and they should behave just as they do with the original tag.

A conditional tag that displays its contents if the current category does not have a parent category "above" it. Alternately the MTElse tag can be used in the MTHasParentCategory tagset.

A conditional tag that displays its contents if the current category has a parent category "above" it.

A conditional tag that displays its contents if the current category does not have any subcategories. Alternately the MTElse tag can be used in the MTHasSubCategories tagset.

A conditional tag that displays its contents if the current category has one or more subcategories.

A conditional tag that displays its contents if the current category is an ancestor of a specified child category in the subcategory hierarchy.

Attributes:

  • child - Required. The category label of the child to match against.

Related:

A conditional tag that displays its contents if the current category is a descendant of a specified parent category in the subcategory hierarchy.

Attributes:

  • parent - Required. The category label of the parent to match against.

Related:

A container tag that creates a context to the current category's parent.

A container tag that lists all the ancestors of the current category.

Attributes:

  • glue - This optional attribute is a shortcut for connecting each category label with its value. Single and double quotes are not permitted in the string.
  • exclude_current -This optional boolean attribute controls the inclusion of the current category in the list.

What is the default value of `exclude_current`? true or false? i'm assuming this is a boolean value. the current docs don't say.

A specialized version of MTCategories that respects the hierarchical structure of categories.

Attributes:

  • include_current - An optional boolean attribute that controls the inclusion of the current category in the list.
  • sort_method - An optional and advanced usage attribute. A fully qualified Perl method name to be used to sort the categories.
  • sort_order - Specifies the sort order of the category labels. Recognized values are "ascend" and "descend." The default is "ascend." This attribute is ignored if sort_method has been set.
  • top - If set to 1, displays only top level categories. Same as using MTTopLevelCategories.

Related

Returns a string that is a concatenation of the current category and its ancestors. Each label is passed through the dirify global filter and "glued" using the forward slash (/) character. This tag is provided for convenience and is the equivalent of the following template tags:

<MTParentCategories glue="/"><$MTCategoryLabel dirify="1"$></MTParentCategories>

The contents of this container tag will be displayed when the first category listed by a MTSubCategories tagset is reached.

The contents of this container tag will be displayed when the last category listed by a MTSubCategories tagset is reached.

Recursively call the MTSubcategories or MTTopLevelCategories container with the subcategories of the category in context. This tag, when placed at the end of loop controlled by one of the tags above will cause them to recursively descend into any subcategories that exist during the loop.

Attributes:

  • max_depth - An optional attribute that specifies the maximum number of times the system should recurse. The default is infinite depth.

Example:

The following code prints out a recursive list of categories/subcategories, linking those with entries assigned to their category archive pages.

<MTTopLevelCategories>
    <MTSubCatIsFirst><ul></MTSubCatIsFirst>
        <MTIfNonZero tag="MTCategoryCount">
            <li><a href="<$MTCategoryArchiveLink$>"
            title="<$MTCategoryDescription$>"><MTCategoryLabel></a>
        <MTElse>
            <li><MTCategoryLabel>
        </MTElse>
        </MTIfNonZero>
        <MTSubCatsRecurse>
        </li>
    <MTSubCatIsLast></ul></MTSubCatIsLast>
</MTTopLevelCategories>

Or more simply:

<MTTopLevelCategories>
    <MTCategoryLabel>
    <MTSubCatsRecurse>
</MTTopLevelCategories>

Related

A container listing the categories that do not have a parent and exist at "the top" of the category hierarchy. Same as using MTSubCategories top="1".

Related

A container tag that creates a context to the top-level ancestor of the current category.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.