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>
I had to hack a bit your plugin to suit my purposes. Explained in this forum thread
Bonne chance!
| << rsx_page_number |
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?