Hi,
The span global above is really for use with pages like
page.cgi?p=list
where you have a new template called list.html. (You can use it on other pages - just takes a bit of modification).
To get the span, copy the global and call it span_pages and then where you want the span in the template <%span_pages%>
Near the top of the page (above the span) you'll need
<%ifnot nh%><%set nh=1%><%endif%>
You should be able to use this straight away and get a span list with the correct number of pages - try it and see - if you don't let me know, I may have missed out something.
The next problem is to get the correct links/records on each page.
This is where you need another global which selects the links/records. In the global you need to make sure that you have these lines:
my $tags = shift;
my $db = $DB->table ('Links'); #or whichever table you are taking records from
my $nh = $tags->{nh}||1;
my $mh = $tags->{maxhits}||15; #Make sure this matches the value you're using in the span global
my $offset = ($nh-1) * $mh;
$db->select_options ("ORDER BY Fieldname DESC", "LIMIT $offset, $mh");
I hope that helps a bit.
Laura.
The UK High Street
The span global above is really for use with pages like
page.cgi?p=list
where you have a new template called list.html. (You can use it on other pages - just takes a bit of modification).
To get the span, copy the global and call it span_pages and then where you want the span in the template <%span_pages%>
Near the top of the page (above the span) you'll need
<%ifnot nh%><%set nh=1%><%endif%>
Optional tags:
<%set maxhits=10%> - or what ever number of links you want per page (you can just set this in the global - but this means you can use the span global for different lists with different numbers of records per page).
<%set numhits=100%> - again you can set this in the global. You may want to look up the exact number of records in the global rather than using a fixed number.
You should be able to use this straight away and get a span list with the correct number of pages - try it and see - if you don't let me know, I may have missed out something.
The next problem is to get the correct links/records on each page.
This is where you need another global which selects the links/records. In the global you need to make sure that you have these lines:
my $tags = shift;
my $db = $DB->table ('Links'); #or whichever table you are taking records from
my $nh = $tags->{nh}||1;
my $mh = $tags->{maxhits}||15; #Make sure this matches the value you're using in the span global
my $offset = ($nh-1) * $mh;
$db->select_options ("ORDER BY Fieldname DESC", "LIMIT $offset, $mh");
I hope that helps a bit.
Laura.
The UK High Street