category list
From Textbook
<txp:category_list />
The category_list tag can be used as either a single tag or container tag which is used to produce a list of linked categories.
Contents |
Attributes
Tag will accept the following attributes (case-sensitive):
- parent="category name"
- Return only specified category and its "children" categories.
- categories="category name(s)"
- Comma-separated list of categories to include, displayed in the order specified (unless overridden by
sortattribute). Use category names not Titles here -- note that TXP automatically converts the names to lower case and converts spaces to hyphens when they are created - Default: unset (all categories).
- exclude="category name(s)"
- List of category names which will be excluded from the list.
categoriestakes precendence overexclude. - Default: unset.
- type="category type"
- Available values:
article,image,link,file. - Default:
article. - children="boolean"
- Can limit the list depth to one level below the parent category.
- Values:
0(no children, i.e. only show one level below the parent) or1(all nested categories). - Default:
1 - sort="sort value(s)"
- How to sort the resulting list.
- Values:
idnametypeparenttitlerand()(random)
- Default:
name asc. - form="form name"
- Use the specified form to process each included category.
- label="text"
- String to be prepended to the list.
- Default: unset.
- section="section name"
- Link to specified section.
- Default: unset, resulting in links without section restriction.
- this_section="boolean"
- Link to currently active section (overrides
sectionattribute). - Values:
0(no) or1(yes). - Default:
0. - labeltag="tag"
- (X)HTML tag (without brackets) to wrap around
label. - Default: unset.
- wraptag="tag"
- (X)HTML tag (without brackets) to wrap around list.
- Default: unset.
- break="value"
- (X)HTML tag (without brackets) or string used to separate list items.
- Default:
br. - class="class name"
- (X)HTML class attribute to be applied to
wraptag. - Default:
category_list. - active_class="class name"
- (X)HTML class attribute to be applied to the "active" or current link in a list (only works in the single tag without the
formattribute). - Default: unset.
Examples
Example 1: Labelled category list
<txp:category_list label="Categories" wraptag="p" break="br" />
Example 2: As an unordered list
<txp:category_list break="li" wraptag="ul" />
Styles could go this way
.category_list {
list-style-type:none;
}
Example 3: Set active class using the container tag
This code will add class="active" to the <li> element around the "current" category in the list.
<txp:category_list wraptag="ul" break=""> <li<txp:if_category name='<txp:category />'> class="active"</txp:if_category>> <txp:category title="1" link="1" /> </li> </txp:category_list>
Genealogy
Version 4.0.7
- Can be used as a container tag.
-
formandchildrenattributes added.
Version 4.0.4
-
active_class,categories,exclude,section,this_sectionadded.




