Is it only happening for the first entry (ie. the categories after the first one show up fine)? If so, then this patch should fix things:
Code:
--- glinks/cgi/admin/Links/Build.pm 2004/09/18 00:15:36 1.94
+++ glinks/cgi/admin/Links/Build.pm 2005/01/20 01:21:19 1.94.2.1
@@ -3,7 +3,7 @@
#
# Website : http://gossamer-threads.com/
# Support : http://gossamer-threads.com/scripts/support/
-# Revision : $Id: Build.pm,v 1.94 2004/09/18 00:15:36 jagerman Exp $
+# Revision : $Id: Build.pm,v 1.94.2.1 2005/01/20 01:21:19 jagerman Exp $
#
# Copyright (c) 2001
Gossamer Threads Inc. All Rights Reserved.
# Redistribution in part or in whole strictly prohibited. Please
@@ -41,8 +41,7 @@ sub build_home {
$cat_db->select_options("ORDER BY $CFG->{build_category_sort}") if $CFG->{build_category_sort};
my $sth = $cat_db->select( { FatherID => 0 } );
-# Will get shifted off in print_cat.
- my $root = [{}];
+ my $root = [];
while (my $cat = $sth->fetchrow_hashref) {
push @$root, $cat;
}
@@ -50,7 +49,7 @@ sub build_home {
# print_cat generates HTML (meaning you don't really have complete control
# over your installation's HTML), but the current complexity of print_cat
# makes that difficult.
- my $cat_list = Links::SiteHTML::display('print_cat', $root);
+ my $cat_list = Links::SiteHTML::display('print_cat', [{}, @$root]);
return Links::SiteHTML::display('home', { category => $cat_list, category_loop => $root, grand_total => $GRAND_TOTAL });
}
@@ -681,7 +680,7 @@ sub build_category {
# Get the subcategories and related categories as either Yahoo style (integrated) or
# separated into two outputs..
- $tplvars{category_loop} = [$category];
+ $tplvars{category_loop} = [];
if ($CFG->{build_category_yahoo}) {
my @subcat_ids = $cat_db->select(ID => { FatherID => $category->{ID} })->fetchall_list;
my %related_ids = $related_db->select(qw/RelatedID RelationName/ => { CategoryID => $category->{ID} })->fetchall_list;
@@ -698,12 +697,11 @@ sub build_category {
my $print_cat;
$tplvars{category} = sub {
return $print_cat if defined $print_cat;
- return $print_cat = Links::SiteHTML::display('print_cat', $tplvars{category_loop});
+ return $print_cat = Links::SiteHTML::display('print_cat', [$category, @{$tplvars{category_loop}}]);
};
}
else {
$tplvars{category} = '';
- shift @{$tplvars{category_loop}}; # The loop var shouldn't have the root cat.
}
}
else {
@@ -713,16 +711,15 @@ sub build_category {
while (my $cat = $sth->fetchrow_hashref) {
push @{$tplvars{category_loop}}, $cat;
}
- if (@{$tplvars{category_loop}} > 1) {
+ if (@{$tplvars{category_loop}}) {
my $print_cat;
$tplvars{category} = sub {
return $print_cat if defined $print_cat;
- return $print_cat = Links::SiteHTML::display('print_cat', $tplvars{category_loop});
+ return $print_cat = Links::SiteHTML::display('print_cat', [$category, @{$tplvars{category_loop}}]);
};
}
else {
$tplvars{category} = '';
- shift @{$tplvars{category_loop}}; # The loop var shouldn't have the root cat.
}
$tplvars{related} = '';
$tplvars{related_loop} = [];