>How about posting the alterations you've
>tried, and we may be able to help you?
Ok - Sorry for not including some of this earlier:
I won't list all the details fo the non-english MOD from the Links resource center,
except to summarize that it involves adding an alpha field to category.def,
inputting the non-english (Chinese in our case) category name there, and having
that field used for the name display, with the regular $category_name used for
the URL. The line in my category.def is
Nonenglish => [8, 'alpha', 40, 75, 0, '', ''],
For the Yahoo v2.1 MOD, I changed the default field 8 to be field 9:
SubCatStyle => [9, 'alpha', 40, 100, 0, '(ALL)1', '']
In site_html_templates.pl, sub site_html_print_cat is where I am struggling.
I will include the complete subroutine below as I have it now. Basically, I
need to figure out how to have this line:
$output .= qq~<a class="subcat" href="$url">$category_name</a>~;
modified to display the $nonenglish value instead of the $category_name value.
I tried $output .= qq~<a class="subcat" href="$url">$nonenglish</a>~; but that just
gave me "ALL" for each category, so the subroutine seems to be defaulting to the
$description value.
In foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($subcatstyle eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &build_last_title_mb($nonenglish)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &kategorie_title_mb($nonenglish)) :
($_ eq "$subcat/$category_name" or next);
I tried each of those commented changes, but the result was confusing. At first,
I thought that $category_name was already set to the value of $nonenglish, due to
the earlier if statement:
if ($nonenglish eq "") {
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
}
else {
$category_name = &build_last_title_mb($nonenglish);
}
But then why would the last line of the above foreach statement give the correct URL
(which it does)?
Anyway - here is the entire site_html_print_cat subroutine from my site_html_templates.pl
file. I just don't have enough knowledge to figure this out - or perhaps I should have
taken that login course in University.
-Spode
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) = @_;
# ***************************************** nonenglish modification - begin ****************
# my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i, $nonenglish);
# ***************************************** nonenglish modification - end ******************
my ($half) = int (($#subcat+2) / 2);
# Print Header.
$output = qq|<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;
foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];
# ***************************************** nonenglish modification - begin ****************
($nonenglish) = @{$category{$subcat}}[8];
# ***************************************** nonenglish modification - end ******************
# ***************************************** yahoo 2.1 modification - begin ****************
($subcatstyle) = @{$category{$subcat}}[9];
# ***************************************** yahoo 2.1 modification - end ******************
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
# ***************************************** nonenglish modification - begin ****************
# if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
if ($nonenglish eq "") {
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
}
else {
$category_name = &build_last_title_mb($nonenglish);
}
# ***************************************** nonenglish modification - end ******************
$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++;
# ***************************************** yahoo 2.1 modification - begin ****************
# 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> |;
# $output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
# $output .= qq|</dt>|;
# $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;
#}
# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<a class="catlist" href="$url">$category_name</a> <font class="catlist">($numlinks)</font> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|<BR>|;
if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($subcatstyle, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $subcatstyle);
$output .= qq~<DD>~ if ($style eq "1");
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
($subcatstyle eq "ALL" && $#subcatsub == 0) ?
($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &build_last_title_mb($nonenglish)) :
#($_ =~ m,.*/([^/]+)$, and $category_name = &kategorie_title_mb($nonenglish)) :
($_ eq "$subcat/$category_name" or next);
if ($style eq "1") {
$length += length($nonenglish);
($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~<a class="subcat" href="$url">$category_name</a>~;
#$output .= qq~<a class="subcat" href="$url">$nonenglish</a>~;
$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;
}
# ***************************************** yahoo 2.1 modification - end ****************