Hi,
I have a Problem with SPAN Pages while I try to make the navbar a little bit smarter.
This is my Code in build.pm and in red are my changes but now I did not find where
I have to change the code for the actual page. See the attached Images please.
Code:
$SUBS{build_toolbar} = <<'END_OF_SUB'; sub build_toolbar {
# --------------------------------------------------------
# Create an Altavista style toolbar for the next and previous pages.
#
my $opts = shift;
my $root_url = $opts->{url};
my $first_url = $opts->{first_url} || ($root_url . '/' . $CFG->{build_index});
my $next_url = $opts->{next_url} || ($root_url . '/more');
my $numhits = $opts->{numlinks};
my $nh = $opts->{nh};
my $maxhits = $opts->{mh} || $CFG->{build_links_per_page};
my ($next_hit, $prev_hit, $left, $right, $upper, $lower, $url, $i);
$next_hit = $nh + 1;
$prev_hit = $nh - 1;
# First, set how many pages we have on the left and the right.
$left = $nh; $right = int($numhits/$maxhits) - $nh;
# Then work out what page number we can go above and below.
($left > 7) ? ($lower = $left - 7) : ($lower = 1);
($right > 7) ? ($upper = $nh + 7) : ($upper = int($numhits/$maxhits) + 1);
# Finally, adjust those page numbers if we are near an endpoint.
(7 - $nh >= 0) and ($upper = $upper + (8 - $nh));
($nh > ($numhits/$maxhits - 7)) and ($lower = $lower - ($nh - int($numhits/$maxhits - 7) - 1));
$url = "";
# Then let's go through the pages and build the HTML.
($nh > 1) and (($nh == 2) ? ($url .= qq~<li><a href="$first_url">zurück</a></li> ~) : ($url .= qq~<li><a href="$next_url$prev_hit$CFG->{build_extension}">zurück</a></li> ~));
for ($i = 1; $i <= int($numhits/$maxhits) + 1; $i++) {
if ($i < $lower) { $url .= " ... "; $i = ($lower-1); next; }
if ($i > $upper) { $url .= " ... "; last; }
if ($i == 1) { ($i == $nh) ? ($url .= qq~$i ~) : ($url .= qq~<li><a href="$first_url">$i</a></li> ~); }
else { ($i == $nh) ? ($url .= qq~$i ~) : ($url .= qq~<li><a href="$next_url$i$CFG->{build_extension}">$i</a></li> ~); }
if ($i * $maxhits == $numhits) { $nh == $i and $next_hit = $i; last; }
}
$url .= qq~<li><a href="$next_url$next_hit$CFG->{build_extension}">weiter</a></li> ~ unless ($next_hit == $nh or ($nh * $maxhits > $numhits));
return $url;
}
END_OF_SUB
Best regards from
Bremen/Germany
Lothar