Gossamer Forum
Home : Products : Links 2.0 : Customization :

Problem: Nonenglish & Yahoo Style SubCategory Mod

Quote Reply
Problem: Nonenglish & Yahoo Style SubCategory Mod
Hi,

I'm using Links 2.0 (template-based) w/"Nonenglish or special characters in categoryname" by Matthias Berndt (Matthias_Berndt@csi.com) and "Yahoo Style SubCategory Listings Mod" by Widgetz and several other mods. In the german language we have specific characters. Both mods work well and these characters are displayed in the category pages and all others apart from the first index page, where the characters aren't displayed correctly in the subcategory names. The nonenglish mod uses a new field in category.def:

Nonenglish => [8, 'alpha', 40, 75, 0, '', ''],

I think that the subcategory names aren't using this field. Here is the Code from site_html_templates.pl, which is referring to this problem (I'm not sure about this, but I think that somewhere in the subcategory mods part the Nonenglish field must be inserted or used):

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="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

# ***************************************** updated & new graphic modification - begin ********
foreach $subcat (sort @subcat) {
my $mod = $stats{"$subcat"}[3];
my $new_add = $stats{"$subcat"}[4];
($description) = @{$category{$subcat}}[2];
# ***************************************** updated & new graphic modification - end *********
# ***************************************** subcategories like yahoo v2.1 modification - begin ***
($subcatstyle) = @{$category{$subcat}}[9];
# ***************************************** subcategories like yahoo v2.1 modification - end ****
# ***************************************** nonenglish modification - begin ****************
($nonenglish) = @{$category{$subcat}}[8];
# ***************************************** nonenglish modification - end ******************

# First let's get the name, number of links, and last modified date...
# ***************************************** root & category directory modification - begin ******
$url = "$build_cat_url/" . &urlencode($subcat) . "/";
# ***************************************** root & category directory modification - end *******
# ***************************************** 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++;

# Then we print out the name linked, new if it's new, and popular if its popular.
# ***************************************** subcategories like yahoo v2.1 modification - begin ***
$output .= qq|
<strong><a class="catlist" href="$url">$category_name</a></strong> <small class="catlist">($numlinks)</small>|;
# ***************************************** updated & new graphic modification - begin ********
if ($new_add eq "Yes") {
$days_old = &days_old($stats{"$subcat"}[2]);
if ($days_old <= 2) { $output .= qq| $new_1|; }
elsif ($days_old <= 7) { $output .= qq| $new_3|; }
elsif ($days_old <= 14) { $output .= qq| $new_7|; }
}
if ($mod eq "Yes") { $output .= qq~ $updated~; }
# ***************************************** updated & new graphic modification - end *********
$output .= qq|<BR>|;
if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {
($subcatstyle, $style) = ($1, $2);
$s = 0;
@subcatsub = split (/\|/, $subcatstyle);
$output .= qq~ ~ if ($style eq "1");
foreach $category_name (@subcatsub) {
foreach (sort @{$subcategories{$subcat}}) {
# ***************************************** nonenglish & subcategories modification - begin ****
($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub = $nonenglish if ($nonenglish);
# ***************************************** nonenglish & subcategories modification - end ******
($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");
}
# ***************************************** root & category directory modification - begin ******
$url = "$build_cat_url/" . &urlencode($_) . "/";
# ***************************************** root & category directory modification - end *******
$output .= qq~<LI>~ if ($style eq "2");
$output .= qq~<font size="1"><a class="subcat" href="$url">$category_name</a></small></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;
}
# ***************************************** subcategories like yahoo v2.1 modification - end ****

# ***************************************** nonenglish modification - begin ****************
sub kategorie_title_mb {
# --------------------------------------------------------
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
@kategorien = <DB>;
close DB;

my ($input, $output, $title, $kategorie, @fields);

$input = $_[0];
$title = "";

KATEGORIE: foreach $kategorie (@kategorien) {
if ($kategorie =~ /^#/) { next KATEGORIE; } # Skip comment lines.
chomp ($kategorie);
@fields = &split_decode ($kategorie);
if (@fields[1] eq $input) {
$title = @fields[8];
$title =~ s,\\, : ,g;
last KATEGORIE;
}
}
if ($title eq "") {
$output = &build_clean ($input);
}
else {
$output = $title;
}

return $output;
}
# ***************************************** nonenglish modification - end ******************

I'm appreciating your answers.

Phil.

Subject Author Views Date
Thread Problem: Nonenglish & Yahoo Style SubCategory Mod uzsrb3 6143 Aug 8, 2000, 5:57 AM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
jdunes 6084 Aug 8, 2000, 7:50 AM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
sponge 6082 Aug 8, 2000, 11:47 AM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
jdunes 6051 Aug 8, 2000, 9:08 PM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
sponge 6054 Aug 8, 2000, 10:37 PM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
uzsrb3 6068 Aug 9, 2000, 12:26 PM
Post Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
uzsrb3 6004 Aug 16, 2000, 2:12 PM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
Vs_Greg 5819 Nov 14, 2000, 2:25 PM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
sponge 5815 Nov 14, 2000, 4:47 PM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
Vs_Greg 5785 Nov 16, 2000, 12:17 PM
Thread Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
sponge 5808 Nov 16, 2000, 8:37 PM
Post Re: Problem: Nonenglish & Yahoo Style SubCategory Mod
Vs_Greg 5786 Nov 17, 2000, 12:23 PM
Post Re: [sponge] Problem: Nonenglish & Yahoo Style SubCategory Mod
jigme 5396 Sep 3, 2002, 11:51 AM