Gossamer Forum
Home : Products : Links 2.0 : Customization :

How to arrange categories on main list page?

Quote Reply
How to arrange categories on main list page?
Dear All,

Please take a look at the following:

http://www.aizuddindanian.com/voi/blinks/

My problem is that the category links are placed side-by-side.

Can anyone tell me which file to modify in order to get the links to the categories by be placed one-on-top-of-the-other?

For example (list format - this is what i want):

Great Malaysian Blog List

General Blog List

(instead of - side-by-side format)

General Blog List | Great Malaysian Blog List

Thanks to all for your kind assistance.

Peace,
Aizuddin Danian
Quote Reply
Re: [Aizuddin] How to arrange categories on main list page? In reply to
Links splits the category links list into two columns. If you'd like your links to be in a single column, then you need to open site_html_templates.pl and modify site_html_print_cat. What needs to be changed should be fairly obvious so you should be able to figure it out on your own.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [Aizuddin] How to arrange categories on main list page? In reply to
If you add more than categories, they will begin to stack up. If you only want the two, remove the code that looks like this from the site_html_templates:

Code:
my ($half) = int (($#subcat+2) / 2);
$columns = '2'; #number of columns
my ($half) = int (($#subcat+2) / $columns);
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
# if ($i == $half) {
# $output .= qq~</td><td valign="top">\n~;
$i++;
# }
Good luck!


Leonard
aka PerlFlunkie
Quote Reply
Re: [Aizuddin] How to arrange categories on main list page? In reply to
Dear All,

Thanks for the help. I've gotten it to work the way i want. Goto http://www.aizuddindanian.com/voi/blist/ to check it out.

My final code for site_html_template.pl is:

Code:
my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+2) / 2);

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

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

# 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></tr><tr><td valign="top">\n|;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<dl><dt><strong><a href="$url">$category_name</a></strong><small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<br><span>$description </span>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl>|;
}



# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;