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.

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
I had this installed at one time but had other problems with mods, but I did see somewhere around august of 99 (towards the end) where Apachi??? and Eliot had posted their working versions:::

try a search for:

Subcategories Like Yahoo/Templates/Non-English

the full search not "and" the above title should take you somewhere close to where you want to go.

luck

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
I have a copy of the yahoo mod at my site that I made while helping someone else get it to work. I don't know if it will work with the non-english mod, but it IS an edited version of the one Eliot posted a while back that jdunes is refering to.

http://ucmd.virtualave.net/links_mods/yahoo-w.txt

--Drew
Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
I'm sorry if I'm wrong but I think if I remember correctly that Eliot actually posted a combined version in that post of non-english + yahoo.

But please do try Junko's suggestion first, I have feeling that he/she is a perl programmer, while I'm not.

I wish that I didn't trash mine, non-english wasn't very mod friendly for non-perl people like me so I've been playing with a regular version and hoping to screw things up later by trying non-english input.

hoping to get japanese to work ... hmm thoughts for later

g-luck

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
In Reply To:
I have feeling that he/she is a perl programmer
Hardly... while I've piddled around for a while, I didn't start learning Perl untill recently. I've only written a couple scripts, nothing major.

Actually, the one I posted above is NOT for the nonenglish mod. However, I think I found a working nonenglish version. It's the one jdunes thought Apachi posted. Click here: yahoo Apachi.

Good luck Smile!

--Drew
Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
@junko, jdunes: Thank you for your postings. I found the "Apachi"-thread. I read this thread before: The only problem is that I couldn't find $subcatsub2 in my sub site_html_print_cat in site_html_templates.pl. Apachi inserted this Code:

$subcatsub2 = $subcatsub;

between these lines:

($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub2 = $nonenglish if ($nonenglish);

In my file I have these two lines instead:

($nonenglish) = @{$category{$subcatsub}}[8];
$subcatsub = $nonenglish if ($nonenglish);

I'm not a perl programmer :-), so do you have any further ideas?

Phil.

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
I don't understand why Apachi uses a different Code in his Script then the one I'm using???

Phil.

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
Hi!
i've instaled Favorites from the link you have provided..works almost perfect..when i click on favourites and want to see all my favourites..it says "You have not saved any favorites"

any idea
Thanks
gregor

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
Start over with a clean copy.

Download the templates version:
http://www.findinghim.com/...ds/portal/templates/

Open portal.txt and find this:
Code:
$domain = '.findhinghim.com';
#important!!! unless you are on a subdomain, keep the '.' before the domain name
and put your domain where 'findinghim.com' is. If you are on a top-level domain (something.com), then make sure a period precedes your domain name (as in the code sample above). If you are on a subdomain (something.something.com), then do NOT precede the subdomain with a period. The same goes if you only have an IP address.

In your link.html template, add the following code:
Code:
<a href="<%db_cgi_url%>/portal.cgi?action=add&ID=<%ID%>">PortalLinks</a>
Upload all the templates to your templates directory and CHMOD 666. Upload portal.txt to your user cgi directory, rename to portal.cgi, and CHMOD 755.

Happy Coding,

--Drew
http://www.FindingHim.com
Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
Hi
my links are at
www.home.netsi.net/vstopnice/cgi-bin/links/pages

so what shoul i write there in portal.cgi

thanks
gregor

Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
follow the instructions...
In Reply To:
#important!!! unless you are on a subdomain, keep the '.' before the domain name
and
In Reply To:
If you are on a subdomain (something.something.com), then do NOT precede the subdomain with a period.
So it should look like:
Code:
$domain = 'home.netsi.net';
BTW: The url to your Links pages is http://home.netsi.net/vstopnice/links/pages/ not http://www.home.netsi.net/vstopnice/cgi-bin/links/pages (which brings up a server not found error). Smile

Happy Coding,

--Drew
http://www.FindingHim.com
Quote Reply
Re: Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
Hi Junko!
Thanks a lot it works great now

thanks and bye
Gregor

p.s. do you know anything about this error on building pages

Zero Sized Reply
Squid did not receive any data for this request.


Quote Reply
Re: [sponge] Problem: Nonenglish & Yahoo Style SubCategory Mod In reply to
this adress does not work anymore

http://ucmd.virtualave.net/links_mods/yahoo-w.txt



any other link ?



tanx