[Catalyst] OT: Better TT pager?
Jesse Sheidlower
jester at panix.com
Tue Dec 23 11:34:06 GMT 2008
Some time ago, I developed or stole a TT pager that I now use
in all of my Cat apps. It looks like this, though occasionally
with minor CSS tweaks:
---
<hr>
[% IF pager.last_page > 1 %]
<p><span class="lead">
[% IF pager.previous_page %]
[<a href="[% c.req.uri_with({'page' => pager.previous_page}) %]">previous</a
>]
[% ELSE %]
[previous]
[% END %]
[% FOR page IN [1..pager.last_page] %]
[% IF page == pager.current_page %]
[[% page %]]
[% ELSE %]
[<a href="[% c.req.uri_with({'page' => page}) %]">[% page %]</a>]
[% END %]
[% END # FOR...%]
[% IF pager.next_page %]
[<a href="[% c.req.uri_with({'page' => pager.next_page}) %]">next</a>]
[% ELSE %]
[next]
[% END %]
</span></p>
[% END # IF... %]
---
However, a frustration is that when I have excessively large
result sets (such as might generate dozens or hundreds of
pages), it takes a long to generate and looks like hell. So
I'd like to change this to one that only shows, say, 10 pages,
and then has a "previous ten/next ten" and/or "first"/"last"
or something like that, whatever the standard is now.
Does someone have a model I can steal from?
Thanks.
Jesse
More information about the Catalyst
mailing list