Textpattern logo

Help?

section list

From Textbook

<txp:section_list />

The section_list tag is a single or a container tag which is used to produce a list of linked sections. When used as a container tag, it is used as an opening and closing pair, like this:

<txp:section_list>
...contained statements...
</txp:section_list>

Contents

Attributes

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

sections="section name(s)"
Comma-separated list of section names to include in the list, displayed in specified order (unless overridden by the sort attribute).
Default: unset (all sections)
exclude="section name(s)"
Comma-separated list of section names to exclude from the list. Sections takes preecendence over exclude.
Default: unset (none)
include_default="boolean"
Whether to include "default" section in section list.
Default: 0 (no)
sort="sort value(s)"
How to sort the resulting list.
Values:
name
page
css
is_default
in_rss
on_frontpage
searchable
title
rand() (random)
Default: name asc
form="form name"
Use the specified form to process each included section.
label="text"
Label for the top of the list.
Default: unset
default_title="text"
Text used as a title for the "default" section when include_default is set to 1.
Default: Site Name.
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="tag"
(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 the specified wraptag.
Default: section_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 form attribute).
Default: unset

Examples

Example 1: Display a linked section list

Adding the label "Sections" and wrapping the output in a paragraph with each section on its own line:

<txp:section_list label="Sections" wraptag="p" break="br" />

Example 2: Display a styled section list

<txp:section_list break="li" wraptag="ul" />

Styles could go this way

.section_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" section in the list.

<txp:section_list wraptag="ul" break="">
<li<txp:if_section name='<txp:section />'> class="active"</txp:if_section>>
<txp:section title="1" link="1" />
</li>
</txp:section_list>

Genealogy

Version 4.0.7

  • Can be used as a container tag.
  • form attribute added.

Translations [?]...

About Textbook