Textpattern CMS Template Tags

<txp:older /> sing/cont tag, 1 attributes

older

The older tag is both a single tag and a container tag. Should be used in a page after an article tag.

Textpattern will replace this tag with an XHTML link to the next list of articles in the sort order. The container tags wrap the text or tag assigned to the link. As a single tag it outputs the URL for the previous list page.

An article list consists of the assigned number of articles set by the article tag. If there are no articles available having Older status (articles ranked lower, or later, in the present sort criteria than the present bottom of page article) <txp:older> will not display unless the showalways attribute is set to 1. It is normally seen used in tandem with newer.

Given a <txp:article limit =“5” /> tag on the page in question <txp:older> will page down five articles at a time from the most recent post back in time to the oldest.

Note: This tag is context-sensitive, meaning it will only grab content from the section or category being viewed.

attributes

showalways="0" (boolean) 
  • Show wrapped value even when no newer page exists.
<txp:older /> 4 examples

Container tag: link with text

<txp:older>Older</txp:older>

Single tag: link with image

<a href="<txp:older />"><txp:image name="left-arrow.gif" /></a>

Container tag: link with image

<txp:older><txp:image name="left-arrow.gif" /></txp:older> 

The difference between examples 2 and 3 is that the tags in example 2 will display the image even if there are no older articles, those used in example 3 won’t.

Other tags used: image

Older/newer nav system with div wrapper

<div id="navigation">
<txp:older>
   <div class="nav-link prev">
       &laquo; <a href="<txp:older />"><txp:text item="older" /></a>
   </div>
</txp:older>
<txp:newer>
   <div class="nav-link next">
      <a href="<txp:newer />"><txp:text item="newer" /></a> &raquo;
   </div>
</txp:newer>
</div>

A few things to note about this example:

  • The older and newer containers are only output if there is older/newer content
  • The main navigation div is output regardless if there are any older/newer pages so it can remain styled on the page as a placeholder
  • The link and div wrappers are constructed manually and each div is classed so they can be treated differently if required
  • The anchor link only encompasses the textual part, leaving the arrows outside

Other tags used: text, newer