etc_link_to

21 January 2013

A replacement for <txp:link_to_prev/next /> tags that respects any sort order. Can also output links to first/last/nth/current±nth article.

Requirements

Textpattern 4.5.4 or newer.

Usage

<txp:etc_link_to target="next" /> or <txp:etc_link_to target="prev" />.

<txp:etc_link_to target="first,-2,-1,+1,+2,last" break=",">
	<txp:etc_link_title />(<txp:etc_link_id />)
</txp:etc_link_to>

Attributes

  • target: prev,next,first,last,+n,-n,n (default: current article).
  • link: whether to wrap content in a tag (default 1).
  • limit: as usual.
  • offset: as usual. If set to *, the list will be centered (when possible) on the current article.
  • wraptag: as usual (default empty).
  • break: as usual (default empty).
  • showalways: as usual (default 0).

Demo

Look at the dynamic article list on the left sidebar. It is done with

<txp:etc_link_to target="-4,-3,-2,-1,0,+1,+2,+3,+4" wraptag="ul" break="li" limit="5" offset="*">
	<txp:etc_link_title />
</txp:etc_link_to>

And this one will create a preview of the previous and next articles:

 <txp:article_custom wraptag="div"
	id='<txp:etc_link_to target="prev,next" link="0" break=","><txp:etc_link_id /></txp:etc_link_to>'
>
	<h3><txp:permlink><txp:title /></txp:permlink></h3>
	<txp:article_image class="article-image" /><txp:excerpt />
</txp:article_custom>

etc_url

etc_url

Create or modify a Textpattern URL.

etc_preview

Live comments preview.

File(s)