A new version of Ramanan Sivaranjan ‘s textpattern plugin, originally found on textpattern.org. 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{
display:inline;
list-style:none;
margin:0px;
padding:0px;
}
ul.rsx-page-num-list li {
display: inline;
}
.unlinked { font-weight: bold } /* for the current page that is not a link */
Example
<txp:rsx_page_number_list nav='1' leftward='[<< Prev]' rightward='[Next >>]' 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.
Example
<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.
Example
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.
Example
<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.
Do you think you could update the entry on textpattern.org? 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!
| << External Link Textpattern Plugin | jra_links >> |
<txp:rsx_page_number_list /> still uses “older” and “newer” instead of leftward and rightward, just a heads up, thanks!