recommend HTML::Mason
[freeside.git] / httemplate / elements / pager.html
1 <%
2
3   my %opt = @_;
4
5   my $pager = '';
6   if ( $opt{'total'} != $opt{'num_rows'} && $opt{'maxrecords'} ) {
7     unless ( $opt{'offset'} == 0 ) {
8       $cgi->param('offset', $opt{'offset'} - $opt{'maxrecords'});
9 %>
10
11       <A HREF="<%= $cgi->self_url %>"><B><FONT SIZE="+1">Previous</FONT></B></A>
12
13 <%
14     }
15     my $page = 0;
16     for ( my $poff = 0; $poff < $opt{'total'}; $poff += $opt{'maxrecords'} ) {
17       $page++;
18       if ( $opt{'offset'} == $poff ) {
19 %>
20
21         <FONT SIZE="+2"><%= $page %></FONT>
22
23 <%
24       } else {
25         $cgi->param('offset', $poff);
26 %>
27
28         <A HREF="<%= $cgi->self_url %>"><%= $page %></A>
29
30 <%
31       }
32     }
33     unless ( $opt{'offset'} + $opt{'maxrecords'} > $opt{'total'} ) {
34       $cgi->param('offset', $opt{'offset'} + $opt{'maxrecords'});
35 %>
36
37       <A HREF="<%= $cgi->self_url %>"><B><FONT SIZE="+1">Next</FONT></B></A>
38
39 <%
40     }
41   }
42 %>