Texpattern context demo

Current global context
SectionCategoryType
context_demotextpatternlink

Link-category context

Links are another of Txp’s main content types. Here we see global link-category context combined with basic use of local context. Note the linklist tag, used here as a container tag (equivalent to using linklist as a single tag and putting the tag contents into a Txp form).

linklist creates a local link context for each link it finds, and the enclosed tags use that context to output the correct link. link_name and similar tags are not only context sensitive, they are completely context dependent: calling them outside link context throws an error. Txp has no global link context, so these tags must always be enclosed in a linklist tag (or form).

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: