Gossamer Forum
Home : Products : Links 2.0 : Customization :

MAIN categories within Main categories

Quote Reply
MAIN categories within Main categories
Howdy!

Is there a way to one could have many MAIN categories and then within those main categories have also subcategories for each of those main categories? Please keep in mind that I'm currently using SUBCATEGORIES LIKE Yahoo 2.1

See an example below of what I'm looking to implement:

http://dir.yahoo.com/...lege_and_University/

Does anyone outhere have a Links 2.0 running with this kind of deep categorie nesting?...please share your knowledge.



Best regards

John
Quote Reply
Re: [nova3470] MAIN categories within Main categories In reply to
You can put the subcats as deep as want:

main/sub1/sub2/sub3/sub4/sub5 etc

I don't know how the Yahoo mod will take this, but I suspect it will only show the next level down from main.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] MAIN categories within Main categories In reply to
Yeah you're right. The category inside category does not work well with the Yahoo mod. I'll have to just go with the default.

Any idea then how I can single space my subcategories since I'm gonna be creating many subcategories and I don't like how they are showing up double spaced from each other.

SEE: http://dream2reality.com/pages/Entertainment/

MY "site_html_templates.pl"

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

########################################################################################

# THE FOLLOWING DETERMINES YOUR CATEGORY LISTING, IT'S NOT TEMPLATE BASED (YET)! #

########################################################################################



sub site_html_print_cat {

# --------------------------------------------------------

# This routine determines how the list of categories will look.

# We now use a table to split the category name up into two columns.

# For each category you can use the following variables:

#

# $url : The URL to go to that category

# $category_name : The category name with _ and / removed.

# $category_descriptions{$subcat}: The category description (if any).

# $numlinks : The number of links inside that category (and subcategories).

# $mod : The newest link inside of that category.

#



my (@subcat) = @_;

my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);

my ($half) = int (($#subcat+2) / 2);



# Print Header. This moves the 2nd column either left or right (JR)

$output = qq|<div class="margin"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;





foreach $subcat (sort @subcat) {

($description) = @{$category{$subcat}}[2];

($subcatstyle) = @{$category{$subcat}}[8];



# First let's get the name, number of links, and last modified date...

$url = "$build_root_url/" . &urlencode($subcat) . "/";

if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }

$numlinks = $stats{"$subcat"}[0];

$mod = $stats{"$subcat"}[1];



# We check to see if we are half way through, if so we stop this table cell

# and begin a new one (this lets us have category names in two columns).

if ($i == $half) {

$output .= qq|</td><td class="catlist" valign="top">\n|;

}

$i++;



# Then we print out the name linked, new if it's new, and popular if its popular.



if (@{$category{$subcat}}[9] =~ ".gif") {
$output .= qq|<dl><dt><img src="@{$category{$subcat}}[9]"><a class="link" href="$url">$category_name</a><small class="numlinks"> ($numlinks)</small></font> |;
}
else{
$output .= qq|<dl><dt><a href="$url">$category_name</a> ($numlinks) |;
}
$output .= qq|<medium><sup><font color="red">new</font></sup></medium>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><span>$description</span></dd>| if (!($description =~ /^[\s\n]*$/));

$output .= qq|</dl>|;


if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {

($subcatstyle, $style) = ($1, $2);

$s = 0;

@subcatsub = split (/\|/, $subcatstyle);



# IN HERE YOU CAN SPACE THE SUBCATEGORIES LEFT TO RIGHT Sample: $output .= qq~&nsbp;~ if ($style eq "1");

$output .= qq~~ if ($style eq "1");

foreach $category_name (@subcatsub) {

foreach (sort @{$subcategories{$subcat}}) {

($subcatstyle eq "ALL" && $#subcatsub == 0) ?

($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :

($_ eq "$subcat/$category_name" or next);

if ($style eq "1") {

$length += length($category_name);

($length > $subcat_length) and last;

}

if ($s > 0) {

$output .= qq~, ~ and $length += 2 if ($style eq "1");

$output .= qq~ ~ if ($style eq "2");

}

$url = "$build_root_url/" . &urlencode($_) . "/";

$output .= qq~<LI>~ if ($style eq "2");

$output .= qq~<font face="Arial" size="1"><a href="$url">$category_name</a></font>~;



$s++;

last if ($subcatstyle ne "ALL" && $#subcatsub > 0);

}

}

undef $length;

if ($s < $#{$subcategories{$subcat}}) {

$output .= qq~...~ if ($style eq "1");

}

$output .= qq~<BR>~;

}

else { }}



# Don't forget to end the table..


$output .= "</td></tr></table></div>\n";


return $output;

}



1;

Or is there something I can do to correct this from the CSS file.

Thank you much!

John
Quote Reply
Re: [nova3470] MAIN categories within Main categories In reply to
Take out those dl, dt, and dd tags, or change them using CSS (define margin-bottom), you could use an unordered list, or just <br /> tags.


Leonard
aka PerlFlunkie