Present now

jra_links · 3 November 2007, 05:56 by Jean Rajotte

A textpattern plugin which replaces the native link_to_prev and link_to_next by introducing additional section and sort attributes. Download the plugin source here (updated link, used to be v0.1).

These 2 article tags are replacements for link_to_next and link_to_prev which offer a section and sort to better reflect the position in the list.

Optional attributes are:

  • section, which limits the list to the section;
  • showalways, defaults to 0. If 1, tag contents appears even if there is no link (i.e. beginning or end of list);
  • sort, a SQL string which controls the ordering of the list.

The showalways attribute, like in the txp link_to_* tags, was added in version v0.2, thanks to feedback from a user.

The sort attribute was my motivation for this plugin. For example, in a list defined as follows:

<txp:article section='listings' limit="6" sort="custom_7,LastMod desc"/>

once you open an article, what is prev and next?

In this case, it should be this:

<txp:jra_link_to_prev sort="custom_7,LastMod desc" section='listings'>[<< Prev]</txp:jra_link_to_prev>

and this:

<txp:jra_link_to_next sort="custom_7,LastMod desc" section='listings'>[Next >>]</txp:jra_link_to_next>

jordi · 4 February 2008, 19:08 · #

I need links to prev and next articles from two different sections.
Standard TXP link_to_prev and link_to_next restrict their output to current section only. Could your plugin be made to call articles from a comma separated list of sections in the “section” attribute?

jordi · 6 February 2008, 14:27 · #

I had to hack a bit your plugin to suit my purposes. Explained in this forum thread

Bonne chance!

Martin · 20 April 2008, 16:21 · #

Hi there,

this is an excellent plugin!

The only thing I miss is it doesn’t display the actual titles like the built in txp tag can, only a generic < previous | next > is possible.

Would that be difficult to implement?

Cheers Martin

Fritz · 30 April 2008, 14:06 · #

Nice Plugin, but I got a rel=“prev” inside the HTML-Code all the time.

Any bugfix available, or is there a way to overwrite rel=“prev” at the A-Tag for next?

Husain Hakim · 10 September 2008, 12:42 · #

Is it possible to limit the links by category? I have lots of articles being displayed category-wise and I need to have the next/previous links go to articles only within the category supplied in the URL.

Simon Griffee · 13 November 2008, 11:37 · #

Jean, thank you very much for this plugin. Saved me much time!

Add a comment

Textile Help