Gossamer Forum
Home : Products : Links 2.0 : Customization :

Need help with SubCat layout

Quote Reply
Need help with SubCat layout
Ok I can find NO mod that works for 2.0. Basically when I create sub categories, (I dont want them showing on the main page so thats not a problem) when you go to a topic that has subcategories it lists them in one long list. I would like to hvae the sub categories list in a 2 or 3 column table.

The code in nph-build is listed as such:
# Calculate the related entries and put in a <LI> list.

@related = split(/\Q$db_delim\E/, $related); $related = ""; foreach $relation (@related) {
$related .= qq|<li><a href="$build_root_url/|;
$related .= &urlencode($relation);
$related .= qq|/$build_index">|;
$related .=&build_clean($relation);
$related .= "</a></li>";
}

Granted I can take the LI's out but to do a 2 column table with this code its impossible because the above code lists ALL the related links and there is no way to list one, then close a td then list another then close that td and start a new row. What I want seems easy, but with my little knowledge of perl I have no idea how to do it. Can someone help?

Thanks
Kelly
Quote Reply
Re: Need help with SubCat layout In reply to
Actually, the related links are not really designed to be used for that purpose. They are supposed to be used to display only those categories that are actually related to the current category. Be that as it may, I suppose you can use them for all categories. As to the design problem you refer to, this is the code I use (currently -- but like all things, it may go the way of the dodo bird on my system soon):

Code:
# Calculate the related entries and put in a <table> list.
@related = split(/\Q$db_delim\E/, $related); $related = "";
my $total_related = @related;
my $td = 0;
if ($total_related > 0) {
$related = qq|<table border=1 bgcolor="#EFEFEF" valign="top" cellspacing=0><tr>\n|;
foreach $relation (@related) {
if (($td == 2) && ($total_related > 1)) {
$related .= qq|\n</tr><tr>|;
$td = 0;
}
if ((($td == 2) && ($total_related == 1)) or
(($td == 0) && ($total_related == 1))) {
$related .= qq|</tr><tr>
<td valign="top" align="center" colspan=2>
<table cellspacing=2 cellpadding=2 border=0>
<tr><td width="25%"> </td><td width="50%">
<table cellspacing=2 cellpadding=2 border=0>
<tr><td width="100%" colspan=2>
<small><a href="$build_root_url/|;
$related .= &urlencode($relation);
$related .= qq|/$build_index">|;
$related .= &build_clean($relation);
$related .= qq|</a> ($stats{$relation}[0])</small>
</td></tr></table>
</td><td width="25%">
</td></tr></table>
</td>|;
$total_related--;
}
else {
$related .= qq|<td valign="top" width="50%">
<table cellspacing=2 cellpadding=2 border=0>
<td valign="top" width="50%">
<small><a href="$build_root_url/|;
$related .= &urlencode($relation);
$related .= qq|/$build_index">|;
$related .= &build_clean($relation);
$related .= qq|</a> ($stats{$relation}[0])</small>
</td></tr></table>
</td>|;
$total_related--;
$td++;
}
}
$related .= qq|</tr></table>\n|;
}

I hope this helps.
Quote Reply
Re: Need help with SubCat layout In reply to
Ok i will take a look at that. Let me ask you a dumb question then. *grin* If you have a sub category. For instance my site is a Cat links page. So I have a category of Breeds. Then I create Breeds/Persians. Now when people go to Breeds if I want a link to Persians to be at the top of that page, can I use something other then "related links"? Meaning is there a sub category tag or something I am missing? If people dont use related links how are they getting sub categories to display? Thanks Smile
Quote Reply
Re: Need help with SubCat layout In reply to
Basically when I create sub categories, (I dont want them showing on the main page so thats not a problem) when you go to a topic that has subcategories it lists them in one long list.
=====
I don't find either statement true with regards to Links 2.0.

Sub categories are "not" displayed on the main page and they are in fact listed in "two columns" in the category page. No modifications, done.

Is it just me?
Quote Reply
Re: Need help with SubCat layout In reply to
WellI was using <%related%> and not <%subcategories%> related is laid out totally different. I had somehow deleted the who sub category part out of my category.html template so I thought the only way to display a sub category was to use <%related%>.

Anyway I have it all working now however I would love it if someone knew how to make the sub categories 3 columns instead of 2. I have tried the few suggestions I have found on this board and they dont work.

[This message has been edited by webdiva1 (edited March 10, 1999).]