Texpattern context demo

Current global context
SectionCategoryType
context_demodeveloperlink

Link-category context

In other words, linklist and its associated tags for displaying link information are analogous to article and its associated tags such as title and body. images and file_download list do the same vis-a-vis images and files. Each of these tags selects a list of items, then iterates over the list, creating a local context to pass to the tags in the form displaying the item.

An important difference is that while article is always context-sensitive, linklist (and images and file_download_list) can also be used statically. That is, you can specify a category, author, or set of link IDs to display. In that sense, linklist is equivalent to a combination of article and article_custom (for links instead of articles, of course).

An example of linklist used statically:

<txp:linklist category="web-design" wraptag="dl" break="" limit="2">
	<dt><txp:link_name /></dt>
	<dd><a href="<txp:link_url />"><txp:link_url /></a></dd>
	<dd><txp:link_description /></dd>
</txp:linklist>

And now the context-sensitive linklist again:

This code:

<txp:if_category type="link">

	 <!-- Left column -->
	<txp:linklist wraptag="dl" break="" limit="3">
		<dt><txp:link_name /></dt>
		<dd><a href="<txp:link_url />"><txp:link_url /></a></dd>
		<dd><txp:link_description /></dd>
	</txp:linklist>

	 <!-- Right column -->
	<txp:linklist wraptag="dl" break="" limit="3" offset="3">
		<dt><txp:link_name /></dt>
		<dd><a href="<txp:link_url />"><txp:link_url /></a></dd>
		<dd><txp:link_description /></dd>
	</txp:linklist>

	<br class="clearboth" />
</txp:if_category>

produces this output: