Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [blakeb] current link number

Quote Reply
Re: [blakeb] current link number In reply to
This global was designed to be used on the search_results.html template. If you are going to use it on the category.html template, the "nh" tag that holds the current page number is not going to be available on that template. That's why it isn't working. In looking at the tags available on the category.html template, I don't see a tag that only displays the current page number. One of the only tags I see that has the page number in it is the "title" tag. So, unless you've changed the default way the "title" tag is displayed, we can extract the current page number from it to use in the calculations of this global. Try the following:

Code:
sub {

my $tags = shift;
my $total = $tags->{total};
my $high = $Links::CFG->{build_links_per_page};
my $low = 1;
my $name = $tags->{Full_Name};
$name =~ s/\//\: /g;
$name =~ s/$name/$name: Page /g;
my $page = $tags->{title};
$page =~ s/$name//g;

if ($page > 1) {
$low = (($page - 1) * $high) + 1;
}else{
$page = 1;
}

my $top = ($high + $low > $total) ? $total : (($high + $low) - 1);

return "$low - $top of $total";

}

Like I said, this will only work if you haven't changed the way the "title" tag is displayed. The "title" tag is the category path and page number displayed at the top of the template which, for example, looks like:

Computers: Algorithms: Page 2

This is a pretty cheesy way of getting the page number, but it works. Someone else may have a better idea, but this is what I came up with quickly.

BTW: I only tested this in dynamic mode. I'm not sure about static mode.

Sean

Last edited by:

SeanP: Feb 28, 2003, 11:04 PM
Subject Author Views Date
Thread current link number SeanP 11067 Dec 14, 2001, 9:34 AM
Thread Re: [SeanP] current link number
SeanP 10678 Dec 15, 2001, 8:10 PM
Post Re: [SeanP] current link number
SeanP 10610 Dec 18, 2001, 8:40 PM
Post Re: [SeanP] current link number
Matt G 10643 Dec 18, 2001, 10:27 PM
Thread Re: [SeanP] current link number
brewt 10721 Dec 18, 2001, 10:28 PM
Thread Re: [brewt] current link number
Paul 10622 Dec 19, 2001, 3:48 AM
Post Re: [PaulW] current link number
SeanP 10600 Dec 19, 2001, 9:55 AM
Thread Re: [Paul] current link number
eddie123 10153 Feb 12, 2003, 2:55 PM
Thread Re: [eddie123] current link number
blakeb 10147 Feb 28, 2003, 6:55 AM
Thread Re: [blakeb] current link number
SeanP 10118 Feb 28, 2003, 10:46 PM
Thread Re: [SeanP] current link number
klauslovgreen 10087 Mar 7, 2003, 1:27 AM
Thread Re: [klauslovgreen] current link number
SeanP 10021 Mar 7, 2003, 1:39 PM
Thread Re: [SeanP] current link number
klauslovgreen 10014 Mar 7, 2003, 10:12 PM
Thread Re: [klauslovgreen] current link number
SeanP 10036 Mar 7, 2003, 10:27 PM
Thread Re: [SeanP] current link number
klauslovgreen 10070 Mar 7, 2003, 10:35 PM
Post Re: [klauslovgreen] current link number
SeanP 9999 Mar 7, 2003, 11:53 PM
Thread Re: [SeanP] current link number
incik 9261 Jan 17, 2006, 9:46 AM
Thread Re: [incik] current link number
Andy 9281 Jan 17, 2006, 10:03 AM
Thread Re: [Andy] current link number
incik 9290 Jan 17, 2006, 11:10 AM
Thread Re: [incik] current link number
afinlr 9303 Jan 17, 2006, 4:33 PM
Thread Re: [afinlr] current link number
incik 9249 Jan 17, 2006, 4:40 PM
Thread Re: [incik] current link number
afinlr 9286 Jan 17, 2006, 4:43 PM
Thread Re: [afinlr] current link number
afinlr 9294 Jan 17, 2006, 4:48 PM
Thread Re: [afinlr] current link number
incik 9294 Jan 17, 2006, 5:21 PM
Thread Re: [incik] current link number
afinlr 9313 Jan 18, 2006, 4:37 AM
Thread Re: [afinlr] current link number
rascal 1876 Jan 18, 2006, 9:09 PM
Post Re: [rascal] current link number
afinlr 1780 Jan 19, 2006, 2:19 AM
Post Re: [afinlr] current link number
incik 1859 Jan 18, 2006, 9:58 PM