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