Gossamer Forum
Home : Products : Gossamer Links : Discussions :

category_loop problem - 1st category not included in loop - loop not working

Quote Reply
category_loop problem - 1st category not included in loop - loop not working
Hi

I'm trying to build a list of top categories using the category_loop tag.

What happens is that if I have 4 categories (1-4), CATEGORY 1 does not get included in the loop list. Only the following is displayed:

CATEGORY 2
CATEGORY 3
CATEGORY 4

I am using the following loop code:

Code:
<!--BEGIN CATEGORY LOOP-->
CATEGORY LOOP<BR>
<%loop category_loop%>
<%body_font%><b><a class="category_links" href="<%URL%>"><%Short_Name%></a></b></font><br>
<%endloop%>
<HR><BR>
<!--END CATEGORY LOOP-->

I know I am supposed to include <%category_loop%> or <%category%> at the start of the loop, but they don't work.

For example, if I tried:

Code:
<!--BEGIN CATEGORY LOOP-->
CATEGORIES<BR>
<%category_loop%>
<%loop category_loop_loop%>
<%Short_Name%>
<BR>
<%endloop%>
<HR><BR>
<!--END CATEGORY LOOP-->

The result was blank.

If I tried:

Code:
<!--BEGIN CATEGORY LOOP-->
CATEGORIES<BR>
<%category%>
<%loop category_loop%>
<%Short_Name%><BR>
<%endloop%>
<HR><BR>
<!--END CATEGORY LOOP-->

I got all of the categories using subcategory.html PLUS all of the Short_Name cats.

If I tried:

Code:
<!--BEGIN CATEGORY LOOP-->
CATEGORIES<BR>
<%category_loop%>
<%loop category_loop%>
<%Short_Name%><BR>
<%endloop%>
<HR><BR>
<!--END CATEGORY LOOP-->

I got the following:

CATEGORIES
ARRAY(0x85247ac) CATEGORY 2
CATEGORY 3
CATEGORY 4

So, the only category_loop thing that I could get to work (at least in part) was what I mentioned before:

Code:
<!--BEGIN CATEGORY LOOP-->
CATEGORY LOOP<BR>
<%loop category_loop%>
<%body_font%><b><a class="category_links" href="<%URL%>"><%Short_Name%></a></b></font><br>
<%endloop%>
<HR><BR>
<!--END CATEGORY LOOP-->

I've tried every combination that I can come up with, but each time, either the loop doesn't work, or if it does, then CATEGORY 1 gets left out somehow.

Here is what is mentioned about the category_loop (and others) in the comments in the default home.html file:

Quote:
<%--
File : home.html
Description : This is the home page template. It is your main Links SQL page
and displays a list of the top level categories.
Tags : The following tags are available on this page:
category => a list of all subcategories available
category_loop => a loop of all subcategories available.
grand_total => a count of the total number of links available.
--%>

Would anyone know what might be wrong?

Thanks very much. Smile

DogTags


------------------------------------------
Quote Reply
Re: [DogTags] category_loop problem - 1st category not included in loop - loop not working In reply to
Hi,

This is a bug. If you edit admin/Links/Build.pm and remove:

line 586:
# Remove the root category, was only used for the print_cat function.
shift @{$display{category_loop}};

and line 48:
shift @$root; # Remove empty parent element.

it should display categories properly using your first example.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] category_loop problem - 1st category not included in loop - loop not working In reply to
Thanks, Alex!

Works great Cool

DogTags


------------------------------------------