Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Category_loop bug

Quote Reply
Category_loop bug
Hello,

There is a problem with the category_loop in 2.2.1. I think it is a bug and I see some ppl HERE already asked about this , but no solution has been posted.
All described bellow happens ONLY when used with category_loop:

<%if category%>
<%loop category_loop%>
<%include subcategory_cat.html%>
<%endloop%>
<%endif%>

and in subcategory_cat.html we have the <%Short_Name%> tag.
I see the following error Unknown Tag: 'Short_Name' No problems if I am n
If I use <%Name%> the Unknown Tag is no more there , but the Top category where I am is still included with its subcategories and we dont want this to happen.

Alex or someone else from the programers..maybe a little help with this.

Regards
Koki

Last edited by:

Koki: Mar 26, 2005, 2:59 PM
Quote Reply
Re: [Koki] Category_loop bug In reply to
<%if category%>
<%loop category_loop%>
<%include subcategory_cat.html%>
<%endloop%>
<%endif%>

What about
<%if category_loop%>
<%loop category_loop%>
<%include subcategory_cat.html%>
<%endloop%>
<%endif%>

Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Category_loop bug In reply to
Hi,

Not working and I realy think that what I posted is the proper format based on some examples posted by Alex. There is simply problem with the category_loop used together with <%Short_Name%>. If you use only

<%if category%>
<%category%>
<%endif%>

here are no errors or showing the top category together with the subcategories. I am prety sure it is a bug.

P.S. Ohh and it is annoying , because If you are using Mel's plugin for Yahoo type subcategories , it lists them also there , together with all the rest...

Koki

Last edited by:

Koki: Mar 26, 2005, 4:06 PM
Quote Reply
Re: [Koki] Category_loop bug In reply to
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} = [];

Adrian
Quote Reply
Re: [brewt] Category_loop bug In reply to
Thank you Adrian:-) Fantastic:-) Works flowless
It's as you said. Only the first entry is screwd. Maybe you can include this patch in Official Bug Fixes
I am almost sure there is nothing about this fix here in the board.

Koki