Hi!
I don't know why always people ask for this mod, it is realy not that hard to do! Widgtetz is realy not the only one around with some perl knowledge. Why is everybody thinking about him as "god of perl and links"? Don't care about him, others will fill in for him!
Doesn't matter! This is code from my links-installation, which does this "yahoo-mod" (I would prefer to call it "subcatagory-mod"). I have done it by myself, it is in no way a copy of widgets mod. So I'm free to show it in this place. You are free to is it!
I have only done this for the template-version, but it should be easy to adopt it for the non-template-version.
in in site_html_templates.pl change this:
Code:
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.
$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) {
my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];
($description) = @{$category{$subcat}}[2];
$mod = $stats{"$subcat"}[1];
# 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 == $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.
$output .= qq|<dl><dt><strong><a class="link" href="$url">$category_name</a></strong> <small class="numlinks">($numlinks)</small> |;
my $days_old = &days_old($mod) / $db_new_cutoff;
if ($days_old <= 0.3) { $output .= qq| $new1|; }
elsif ($days_old <= 0.6) { $output .= qq| $new2|; }
elsif ($days_old <= 1) { $output .= qq| $new3|; }
if ($mod eq "Yes") { $output .= qq~ $updated~; }
$output .= qq|</dt>|;
if ($#{$subcategories{$subcat}} >= 0) {
$v = 0;
$output .= qq~<BR><SPAN CLASS="xsmall">~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) {$subcategory_name = &build_clean($1);}
else {$subcategory_name = &build_clean($subcatsub);}
$output .= qq~<A HREF="$suburl">$subcategory_name</A>~ if ($v <= 5);
$output .= qq~<font color="#000000">...</font>~ if ($v eq "5");
$output .= qq~<font color="#000000">, </font>~ if ($v ne $#{$subcategories{$subcat}} && $v <= 5);
$v++;
}
$output .= qq~</SPAN>~;
} $output .= qq|<dd><span class="descript">$description </span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl>|;
}
# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;
}
Be carefull of this, some markup is hardcoded, and I use CSS! I think this should work, I've marked the new part in red. But I'm not shure, if it is all to do, because I have done this 2 years ago!
You may see a working example at
http://larp-welt.de/.
Bye
Tiggr