Linklist

On this page:

Syntax

<txp:linklist />

The linklist tag is a single or a container tag which is used to produce a list of links from the predefined list created on the Links administration panel.

If used as a container, it must be specified as an opening and closing pair of tags, like this:

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

Attributes

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

author="author login name"
Restrict to links with the specified author.
Default: unset.
auto_detect="string context"
List of Textpattern contexts to consider when automatically searching for links. If you wish to turn off the automatic check, set this to auto_detect=".
Values: category (to look in the URL for a category list) and/or author (to look in the URL for an author list).
Default: category, author.
category="category name(s)"
Restrict to links from specified categories.
Values: (comma separated list of) category name(s). Note: category names may be different to the ‘Title’ you typed when you created the category, as the names are sanitized for URL use. Check the Categories administration panel to ensure you are using the correct names.
Default: unset.
form="form name"
Use specified form.
Default: plainlinks.
id="integer"
Filter the links by this list of ids assigned at link creation time. The IDs can be found on the Links administration panel.
Default: unset.
limit="integer"
Number of links to display.
Default: 0 (no limit).
offset="integer"
The number of links to skip.
Default: 0.
pageby="integer or limit"
Number of links to jump each page. Without this attribute, you cannot navigate using the newer and older tags. Usually you will want to track the limit attribute. Use pageby="limit" to do this, which means you will not have to amend two values if you subsequently decide to alter the limit.
Default: unset
realname="author real name"
Restrict to links with the specified author name.
Default: unset.
sort="sort value(s)"
How to sort resulting list.
Values:
category.
date.
description.
id (link id#).
linkname.
linksort.
rand() (random).
url.
Default: linksort asc.

Common presentational attributes

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

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

Examples

<txp:linklist form="Links" category="general" limit="10" sort="linksort" wraptag="p" />
<txp:if_category name="100">
    <txp:linklist label="First Floor" category="First" wraptag="ol" break="li" />
</txp:if_category>
<txp:if_category name="200">
    <txp:linklist label="Second Floor" category="Second" wraptag="ol" break="li" />
</txp:if_category>

This example uses the displayed page’s category as the criterion for choosing the linklist’s category.

Other tags used: if_category.

Example 3: Used as a container tag

<txp:linklist wraptrag="ol" break="li">
    <txp:link /><br />
    <txp:link_description /><br />
    <txp:linkdesctitle />
</txp:linklist>

The tags within the container are repeated for each link provided by the linklist tag.

Other tags used: link, linkdesctitle, link_description.

Genealogy

Version 4.5.0

id attribute added.

Version 4.3.0

pageby attribute added to enable paging via newer and older tags.
author and realname attributes added.
auto_detect attribute added to allow automatic (URL-based) contextual listings.

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please write an issue and we’ll fix it.