<txp:section_list /> sing/cont tag, 7 attributes

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>

Related: if_first_section, if_last_section

attributes

sections="all sections" 
  • Comma-separated list of section names to include in the list, displayed in specified order (unless overridden by the sort attribute).
exclude="unset" 
  • Comma-separated list of section names to exclude from the list. Sections takes precedence over exclude.
include_default="0" (boolean) 
  • Whether to include “default” section in section list.
sort="name asc" 
  • Values
    • name
    • page
    • css
    • is_default
    • in_rss
    • on_frontpage
    • searchable
    • title
    • rand() (random)
  • Direction
    • asc (ascending)
    • desc (descending)
form="unset" 
  • Use the specified form to process each included section.
default_title="Site Name" 
  • Text used as a title for the “default” section when include_default is set to 1.
active_class="unset" 
  • (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.

presentation

label="unset" 
  • Label prepended to item (or as first list item, where appropriate).
  • if wraptag is available and is set to ol or ul, the label will be the first list item.
labeltag="unset" 
  • (X)HTML tag (without brackets) to wrap around label.
break="br" 
  • (X)HTML tag (without brackets) or string to separate list items.
wraptag="unset" 
  • (X)HTML tag (without brackets) to wrap around the list.
class="section_list" 
  • (X)HTML class attribute to apply to the wraptag.

genealogy

Version 4.0.7

  • Can be used as a container tag.
  • form attribute added.
<txp:section_list /> 3 examples

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" />

Display a styled section list

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

Styles could go this way

.section_list {
list-style-type: none;
}

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>