Alex,
I first had to change all ID numbers into 001, 002. (otherwise the sorting would not work correctly).
And about the endpoints:
I modified the following code, of the build process (detailed_pages), so the last and first detailed page would NOT have a back and next link, BUT it's not working as I would like it to work. So could you please check you piece of code on error's?
Code:
sub build_detailed_view {
# --------------------------------------------------------
# This routine build a single page for every link.
#
my (@values, $id, @records, $firstpageid, $lastpageid, %rec, $count);
if ($build_detail_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name. Reason: $!");
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id = $values[$db_key_pos];
# Now let't remember this ID, so we can sort!
push (@records, $id);
}
close DB;
# Now sort the records so we can make a detalied section, where people can
# browse with back and next links placed on every page.
@records = sort @records;
# End sorting, start determing which ID numbers are the first/last in teh array.
$firstpageid = shift @records;
$lastpageid = pop @records;
# Start building...
print "\t";
open (DB, "<$db_news_name") or &cgierr("unable to open database: $db_news_name. reason: $!");
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp;
@values = &split_decode ($_);
$id = $values[$db_key_pos];
%rec = &array_to_hash (0, @values);
# Set back and next links.
$back_link = "/cgi-bin/jump.cgi?ID=$id&BACK=1" unless ($id == $firstpageid);
$next_link = "/cgi-bin/jump.cgi?ID=$id&NEXT=1" unless ($id == $lastpageid);
open (DETAIL, ">$build_news_detailed_path/$id$build_extension") or &cgierr ("unable to build detail page: $build_news_detailed_path/$id$build_extension. reason: $!");
print DETAIL &site_html_news_detailed (%rec);
close DETAIL;
print qq~$id ~;
(++$count % 10) or print "\n\t";
}
close DB;
print "\n";
}
[This message has been edited by TecLine (edited May 01, 1999).]