Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Links SQL 2.x Problem with SPAN Pages

Quote Reply
Links SQL 2.x Problem with SPAN Pages

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&uuml;ck</a></li> ~) : ($url .= qq~<li><a href="$next_url$prev_hit$CFG->{build_extension}">zur&uuml;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
Subject Author Views Date
Thread Links SQL 2.x Problem with SPAN Pages eljot 7511 Jun 27, 2015, 11:41 AM
Thread Re: [eljot] Links SQL 2.x Problem with SPAN Pages
eljot 7451 Jun 27, 2015, 11:43 AM
Thread Re: [eljot] Links SQL 2.x Problem with SPAN Pages
Andy 7450 Jun 27, 2015, 11:25 PM
Thread Re: [Andy] Links SQL 2.x Problem with SPAN Pages
eljot 7448 Jun 28, 2015, 1:44 AM
Post Re: [eljot] Links SQL 2.x Problem with SPAN Pages
Andy 7437 Jun 28, 2015, 1:52 AM
Thread Re: [eljot] Links SQL 2.x Problem with SPAN Pages
Andy 7443 Jun 28, 2015, 1:54 AM
Thread Re: [Andy] Links SQL 2.x Problem with SPAN Pages
eljot 7434 Jun 28, 2015, 3:34 AM
Thread Re: [eljot] Links SQL 2.x Problem with SPAN Pages
eljot 7423 Jun 28, 2015, 3:42 AM
Thread Re: [eljot] Links SQL 2.x Problem with SPAN Pages
eljot 7423 Jun 28, 2015, 3:45 AM
Post Re: [eljot] Links SQL 2.x Problem with SPAN Pages
Andy 7402 Jun 28, 2015, 7:27 AM