Textpattern CMS Template Tags

<txp:section /> sing/cont tag, 6 attributes

section

The section tag can be used as either a single tag or container tag. It will display information about the section as defined by either the name attribute, the section currently being viewed, or the section of the article being displayed (if used within an article form, or an if_individual_article conditional tag).

When used as a containing tag, it will turn the contents into a link to that section. Otherwise, it will return plain text.

Related: if_section, if_article_section

attributes

title="0" (boolean) 
  • Display either the section name or its title.
link="0" (boolean) 
  • Display as plain text(0) or a link(1).
  • Works only in the single tag.
wraptag="unset" 
  • HTML tag name to be used as the wraptag, without brackets.
class="unset" 
  • CSS class name to apply to the wraptag. If no wraptag is supplied (and link=“1”), the class is applied to the anchor instead.
name="unset" 
  • Sets the link to the named section.
url="0" (boolean)
  • Display plain URL or full link(0).

genealogy

Version 4.0.7

  • Applies class attribute to the <a> element when wraptag is empty.
  • New attribute, url to output URL only.
<txp:section /> 4 examples

Display the current section name

<txp:section />

Display hyperlinked section title

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

What this does…
In an article form, it displays the article’s section title as a hyperlink to the section home page.
Otherwise, it displays the title of the section currently being viewed as a hyperlink to the section home page.

Display a link to a specified section

<txp:section link="1" title="1" wraptag="p" name="archive" />

What this does…
It displays a hyperlink to the ‘archive’ section home page, wrapped in <p> tags, using the section’s title as link text.

Container example

<txp:section name="archive">My Archive</txp:section>

What this does…
It displays the text “My Archive” as a hyperlink to the ‘archive’ section home page.