Present now

rsx_page_number · 20 October 2007, 18:57 by Jean Rajotte

A new version of Ramanan Sivaranjan ‘s textpattern plugin, originally found on I’ve added some options and a new tag. You may download it here: rsx_page_number_v4.0.txt

Here's what the help file says:

Offers the following tags to display page numbers on article list pages: rsx_page_number, rsx_last_page_num, rsx_page_number_nav, rsx_page_number_list, and rsx_to_of.

NOTE: that all these tags may be placed BEFORE and/or AFTER the list tag in your presentation.

<rsx_page_number_nav />

This tag displays a simple navigation widget, that will display arrows to the previous and next pages, and will also display the page number you are on, and the total number of pages. It will look something like: << Page 2 of 7 >>.

Optional Attributes

  • sort, default: asc, determines the meaning of the direction of the arrows. "asc" means LEFT is OLDER, RIGHT is NEWER. Any other value is interpreted as "desc", which means LEFT is NEWER, RIGHT is OLDER. The default is kept for backward compatibility.
  • leftward, default: <<: what to show pointing left.
  • rightward, default: >>: what to show pointing right.
  • older; deprecated: what will show as leftward.
  • newer; deprecated: what will show as rightward.

The text generated is wraped in spans, that can be styled using css. There are three spans generated, with classes: rsx-nav-right, rsx-nav-left, and rsx-nav-middle.

<txp:rsx_page_number_list />

This tag displays a list of page number, that can be used to navigate your site, similar to a listing or search results from google ? i.e a list like 1,2,3,4 ... 100, where the numbers are links to the appropriate page.

Optional Attributes

  • windowsize, default: 5, the page numbers to show in the list.
  • delim, default: ,, the text shown between each page number in the list.
  • nav, default: 0; if value is 1, the list will also include prev and next "bookends".
  • leftward, default: <<: what to show pointing left when nav='1'.
  • rightward, default: >>: what to show pointing right when nav='1'.

The tag generates an unordered list of page numbers (and optional prev/next). The best way to style such a list is with the following CSS:

  ul.rsx-page-num-list li {
    display: inline;
  .unlinked { font-weight: bold }   /*  for the current page that is not a link */


<txp:rsx_page_number_list nav='1' leftward='[&lt;&lt; Prev]' rightward='[Next &gt;&gt;]' delim='' windowsize='5' />
would generate a list like so: [<< Prev] 1... 4 5 6 7 8 ...12 [Next >> ]

<txp:rsx_page_number />

This tag displays the page number associated with the page currently being displayed by textpattern.

Optional Attributes

  • offset, default: 0, a value to offset the current page number.


<txp:newer>page <txp:rsx_page_number offset="-1" /></txp:newer>
would generate a link showing the number of the previous page.

<txp:rsx_last_page_num />

This tag displays the last page number in an article listing.


Page <txp:rsx_page_number /> of <txp:rsx_last_page_num />.
would show "Page 5 of 12"

<txp:rsx_to_of />

This tag generates text according to a mask, rendering placeholders $start, $end, and $total, to represent the number of the first article in the current page, the number of the last article in the current page, and the total number of articles, respectively.

Optional Attributes

  • mask, default: 'Displaying $start to $end (of $total articles)', the text shown once placeholders have been replaced.


<txp:rsx_to_of mask='Showing $start to $end in a line of $total nibs!' />
would generate text showing: "Showing 16 of 20 in a line of 99 nibs!", assuming the current page is 4 and lim='5' in the article list tag.
Doug · 23 October 2007, 23:49 · #

<txp:rsx_page_number_list /> still uses “older” and “newer” instead of leftward and rightward, just a heads up, thanks!

Adam Messinger · 4 December 2007, 00:49 · #

Do you think you could update the entry on I’m not 100% sure, but I don’t think you have to be the author of an article there to edit it. If it turns out I’m wrong, I’m sure the admin wouldn’t mind helping you out if Ramanan says it’s okay.

Thanks for the update!

The Exit · 26 January 2008, 15:50 · #

The plugin adds a s=default to the link. Can this be omitted?

Gabriella · 22 April 2008, 17:20 · #

Anyone know how to make the <txp:rsx_page_number_list /> tag to be a valid xhtml? It seems the “&” in the link doesnt skipped with &amp; or something like that and it makes the Validator screaming.

Any hint?

andreas · 9 September 2008, 17:27 · #


don’t know, whether you still work on the plugin.
Had a problem by using upm_date_archive and rsx_page_number together.
The context of the article list was not recognized in the rsx_page_number function.
There I had to insert the following:

$month = strstr($_SERVER[‘REQUEST_URI’], “month”); $url = ($s != ‘’) ? ‘&amp;s=’.$s : ‘’; $url .= ($c != ‘’) ? ‘&amp;c=’.$c : ‘’; $url .= ($q != ‘’) ? ‘&amp;q=’.$q : ‘’; $url .= ($month != ‘’) ? ‘&amp;’.$month : ‘’;

The “q” option is not tested, but in search lists the same problem occurred.


Adam Messinger · 19 September 2008, 19:14 · #

I’ve only had one problem with this plugin — it displays page-to-page navigation even when there is only one page of articles. To fix this, I added the following conditional statement to the rsx_page_number_nav and rsx_page_number_list functions, right after the global variable declaration in each:

if ( $thispage[‘numPages’] == 1 ) { return; }

With that condition in place, the tags don’t output the page-to-page navigation when there aren’t any additional pages to justify it.

Other than that, the plugin has been great. Thanks. :-)

P.S. A forum thread for this plugin would be very helpful. It would allow your users to share ideas and solutions to the problems they encounter.

Roelof · 28 September 2008, 14:29 · #


I see that this plugin makes this link to my site

Where i want it like this :

Can this be done.


Roelof · 29 September 2008, 15:05 · #


I gave you the wrong email adress of me.
Now you have the good one.

Man Chiu Yeung · 25 November 2008, 11:34 · #

Is it possible to reverse the page count with the old being “1”. This would make it somewhat easier for me to refer to articles by which page they are on as they the page number would now correlate to the articles on it in a constant manner – Thanks!

Henrycha · 14 April 2009, 21:51 · #

i have troubles with txp version 4.08, is there a plugin versiĆ³n of rsx for txp 4.08?

Add a comment

Textile Help