TT Pager

[% IF pager %]
<div class="pager">
    <div class="counter">
        Page [% pager.current_page %] of [% pager.last_page %]
    </div>
    <div>
       [% IF pager.previous_page %]
           <span><a href="[% c.req.uri_with( page => pager.first_page
) %]">&laquo;</a></span>
           <span><a href="[% c.req.uri_with( page =>
pager.previous_page ) %]">&lt;</a></span>
       [% END %]

       [% start = (pager.current_page - 3) > 0 ? (pager.current_page - 3) : 1;
        FOREACH page IN [ start .. pager.last_page ] %]
           [% LAST IF loop.count > 6 %]
           [% IF pager.current_page == page %]
               <span class="current"> [% page %] </span>
           [% ELSE %]
               <span> <a href="[% c.req.uri_with( page => page )
%]">[% page %]</a> </span>
           [% END %]
       [% END %]

       [% IF pager.next_page %]
           <span><a href="[% c.req.uri_with( page => pager.next_page )
%]">&gt;</a></span>
           <span><a href="[% c.req.uri_with( page => pager.last_page )
%]">&raquo;</a></span>
       [% END %]
   </div>
</div>
[% END %]

(modified from http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg05232.html)

My tags:
 
Popular tags:
 
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker