section
From Textpattern CMS User Documentation
<txp: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.
Contents |
Attributes
Tag will accept the following attributes (case-sensitive):
- class="class name"
- CSS class name to apply to the
wraptag. If no wraptag is supplied (andlink="1"), the class is applied to the anchor instead. - Default: unset.
- link="boolean" (works only in the single tag)
- Display as plain text or a link.
- Values:
0or1 - Default:
0(plain text) - name="section name"
- Display the named section.
- Default: unset (display the current section)
- title="boolean"
- Display either the section name or its title.
- Values:
0or1 - Default:
0(name) - url="boolean"
- Display plain URL or full link.
- Values:
0or1 - Default:
0(display title or full link, depending onlink) - wraptag="tag"
- HTML tag name to be used as the wraptag, without brackets.
- Default: unset.
Examples
Example 1: Display the current section name
<txp:section />
Example 2: 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.
Example 3: 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.
Example 4: Container tag 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. HTML output for clean URLs:
<a href="http://yourdomain.tld/archive/>My Archive</a>
and for messy URLs:<a href="http://yourdomain.tld/index.php?s=archive">My Archive</a>
Example 5: Single tag example
<a href="<txp:section name="about" url="1" />"><txp:section name="about" title="1" /></a>
- What this does...
- It displays the section title "About" as a hyperlink to the 'about' section home page. HTML output for clean URLs:
<a href="http://yourdomain.tld/about/">About</a>
and for messy URLs:<a href="http://yourdomain.tld/index.php?s=about">About</a>
Genealogy
Version 4.0.7
- Applies
classattribute to the<a>element whenwraptagis empty. - New attribute,
urlto output URL only.




