Gossamer Forum
Home : Products : Links 2.0 : Customization :

Category links in 3 columns

Quote Reply
Category links in 3 columns
Is it possible to modify sub site_html_print_cat so that the links are output into 3 columns instead of 2?
Quote Reply
Re: [troyid] Category links in 3 columns In reply to
Yes...

http://mainstop.com/...i_columns_links.html


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Category links in 3 columns In reply to
Sorry I didn't phrase my question correctly.

The links I want to remain the same. It is the categories that I want to put into 3 columns.
Quote Reply
Re: [troyid] Category links in 3 columns In reply to
I searched the forum and found a solution. I modified it a little bit and now this is what my sub site_html_print_cat code looks like in site_html_templates.html file. It is 3 columns with bullet points next to each sub-category link. Hope this helps someone else!!

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 ($third) = int ((($#subcat+2) / 3)+1);

# Print Header.
$output = qq|<table width="85%" align="center" border="0" cellspacing="0" cellpadding="0"><tr><td width="33%" class="catlist" valign="top"><ul>\n|;

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];

# 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];

# 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 == $third) {
$output .= qq|</ul></td><td width="33%" class="catlist" valign="top"><ul>\n|;
$i = 0;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<li><a class="link" href="$url">$category_name</a></li><br>|;
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table>\n";
return $output;
}
Quote Reply
Re: [troyid] Category links in 3 columns In reply to
There's a mod fer that, too, but thanks for posting the code that worked for you!


Leonard
aka PerlFlunkie