View Single Post
  #1  
Old 11-16-2002, 09:51 AM
  TelaFirma's Avatar 
TelaFirma TelaFirma is offline
 

X-Adept
  
Join Date: Nov 2002
Location: North Carolina USA
Posts: 930
 

Default Need help customizing category listing

OK... I need some help from the pros here... I am trying to do a customization for the category listing and just cant figure it out.

What I would like is when you click on a category, that you have the subcategory listing below the catagory that was clicked. I know that you can nest sections, but I can't figure out the proper way to do it. The closest that I have gotten is:

Code:
{* $Id: categories.tpl,v 1.14 2002/09/10 12:58:26 zorg Exp $ *} <TABLE border=0 cellPadding=5 cellSpacing=0 width=100%> <TR> <TD class=MenuTitleLine height=26 width=26 valign=center>[img]{$ImagesDir}/dingbats_categorie.gif[/img]</TD> <TD class=MenuTitleLine height=26 valign=center width="80%"><FONT class=TableLeftTitles>{$lng.lbl_categories}</FONT></TD> </TR> <tr><td colspan=2 class="TableLeftElements" nowrap> {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories} <font class=CategoriesList>{ $categories[cat_num].category|escape }</font> {/section} {else} {section name=cat_num loop=$categories} <font class=CategoriesList>{ $categories[cat_num].category|escape }</font> {section name=cat_num loop=$subcategories} <font class=CategoriesList>[*]{ $subcategories[cat_num].category|escape }</font> {/section} {/section} {/if} </td></tr> </TABLE>

This is close but not right. It list the first category only once, then list the main categories again as su categories. Then when you click on a category, it DOES list the sub categories inder the category clicked, but it does not list the remaining categories.

If I change it to:
Code:
{* $Id: categories.tpl,v 1.14 2002/09/10 12:58:26 zorg Exp $ *} <TABLE border=0 cellPadding=5 cellSpacing=0 width=100%> <TR> <TD class=MenuTitleLine height=26 width=26 valign=center>[img]{$ImagesDir}/dingbats_categorie.gif[/img]</TD> <TD class=MenuTitleLine height=26 valign=center width="80%"><FONT class=TableLeftTitles>{$lng.lbl_categories}</FONT></TD> </TR> <tr><td colspan=2 class="TableLeftElements" nowrap> {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories} <font class=CategoriesList>{ $categories[cat_num].category|escape }</font> {/section} {else} {section name=cat_num loop=$categories} <font class=CategoriesList>{ $categories[cat_num].category|escape }</font> {/section} {section name=cat_num loop=$subcategories} <font class=CategoriesList>[*]{ $subcategories[cat_num].category|escape }</font> {/section} {/if} </td></tr> </TABLE>
it will function halfway right, but it lists the sub categories under all the rest of the categories.

Am I making any sense at all?
Reply With Quote