On this page:


<txp:category2 />

The category2 tag can be used as either a single tag or container tag. It will display information of the category as defined by Category 2 of the article being displayed. When used as a containing tag, it will turn the contents into a link to that category. Otherwise, it will return plain text.

This tag may be used within either an article form, or in a page, wrapped in an if_individual_article conditional tag.


Tag will accept the following attributes (case-sensitive):

Whether to link to articles from the same category. Works only in the single tag.
Values: 0 (no) or 1 (yes).
Default: 0.
section="section name"
Restrict to articles from specified section(s).
Values: (comma separated list of) section name(s).
Default: unset, retrieves from all sections.
Whether to output category title, rather than name.
Values: 0 (no, use name) or 1 (yes, use title).
Default: 0.
Whether to only link to articles from the section containing the current article.
Values: 0 (no, allow from any section) or 1 (yes).
Default: 0.

Common presentational attributes

These attributes, which affect presentation, are shared by many tags. Note that default values can vary among tags.

class="class name"
HTML class attribute to be applied to wraptag.
Default: unset (see class cross-reference).
HTML tag to wrap around output, specified without brackets (e.g. wraptag="p").
Default: unset (but see wraptag cross-reference for exceptions).


Example 1: Category name in plain text

    <txp:category2 />

Example 2: Hyperlinked category title

    <txp:category2 link="1" title="1" />

If category2 is ‘Specific stuff’, this tag will display the words ‘Specific stuff’ as a hyperlink to a list of articles in the same category.

Example 3: Container example

    <txp:category2>Other articles in category:
    <txp:category2 title="1" /></txp:category2>

Example 4: Category 1 and 2

    Filed in: <txp:category1 link="1" title="1" />
    <txp:if_article_category number="2">
        and <txp:category2 link="1" title="1" />

Shows a hyperlinked category 1, and also hyperlinked category 2 but only if it is used.

Other tags used: category1, if_article_category.


Version 4.0.4

class, section, this_section and wraptag attributes added.

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please write an issue and we’ll fix it.