Help?

section list

From Textpattern CMS User Documentation

Revision as of 22:00, 4 February 2012 by Bloke (Talk | contribs)

<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 precedence 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.
default_title="text"
Text used as a title for the "default" section when include_default is set to 1.
Default: Site Name.
active_class="class name" (only works in the single tag without the form attribute)
CSS class name to be applied to the "active" or current link in a list.
Default: unset

Common Presentational Attributes

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

label="text"
Label prepended to item.
Default: unset (but see label cross-reference for exceptions).
labeltag="element"
HTML element to wrap (markup) label (e.g., labeltag="h3")
Default: unset.
wraptag="element"
HTML element to wrap (markup) list block (e.g., wraptag="ul")
Default: unset (but see wraptag cross-reference for exceptions).
class="name"
HTML class to apply to the wraptag attribute value.
Default: tag name or unset (see class cross-reference)
break="value"
Where value is an HTML element (e.g., break="li") or some string to separate list items.
Default: br (but see break cross-reference for exceptions).

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 [?]