Gossamer Forum
Home : Products : Links 2.0 : Customization :

Bobise: Using special characters in categories

(Page 1 of 2)
> >
Quote Reply
Bobise: Using special characters in categories
I'm using Links v2 and want to be able to use commas, ampersands, apostrophes and the at (@) symbol in category names. After seeing your suggestion about adding a plus sign (http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/001103.html), I tried adding ,&'@ in the same way to nph-build.cgi and category.def. However, I keep getting a fatal error: syntax error. Is it not possible to add punctuation in this way? I'd rather not add the special character mod for a few commas and was hoping this quick method would work. Any suggestions?

Thanks!
Kathy
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Try adding them to the beginning of the lists. For example, in links.def, make it:

Quote:
^[\w\d,&'@/_-]

and in sub build_check_dir:

Quote:
$chrs = quotemeta (",&'@/_-");

I hope this helps.
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Nope. That didn't work either. When I tried putting them first (",&'@/_-"), I got the same syntax error at
Quote:
admin/category.def line 24, near "'^[\w\d,&'@/"
Unmatched right bracket at admin/category.def line 24, at end of line[end quote]
It didn't even read the _- at the end; they seem to have gotten dropped along the way. Could you please explain what an unmatched right bracket is? If it's just the apostrophe causing the problem, I could live without it.

Thanks for your help,
Kathy
Quote Reply
Re: Bobise: Using special characters in categories In reply to
The unmatched right bracket means that the right-braket is missing. It should look like this in category.def:

Quote:
'^[\w\d,&'@/_-],

There should be a "]" at the end of the line, just before the comma.

I hope this helps.
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Yes, that helps--at least, it explains the problem. For some reason the last three characters _-] are being dropped off. I tried messing around with different combinations, and when I tried ,&'@_-/ I got a new error message: "fatal error: Search pattern not terminated at admin/category.def line 24." Does this mean about the same thing? The bracket even is dropped off when I try adding just & . Why would this happen?

I guess I could have installed the special character mod about 50 times by now, but I'm starting to feel muleheaded about getting this to work. DO you think there's any hope, or should I just give it up?

Kathy

Quote Reply
Re: Bobise: Using special characters in categories In reply to
Hi,
Just a thought... wouldn't you have to cancel out the things like the @ and stuff, or else Perl interprets them as the perl symbol thingy Smile

I'm thinking this:
Quote:
\'^[\w\d,\&\'\@/_-],

I am prolly very wrong though =)


------------------

Robbo
www.Tobia.com
Quote Reply
Re: Bobise: Using special characters in categories In reply to
All right! Cool. You were right...or anyway, partially right. Now I can build categories with those symbols without getting an error message. Links let's me get that far, though, and no further. When I try to build pages, I'm getting a message that there's a CGI error in nph-build.cgi. I'm still messing around with various combinations in nph-build. Tried (",&'@_-"); and (",\&\'\@/_-"); I'll keep shuffling things around on my own, but if you have any suggestions, I'd love to hear them.

Thanks!
Kathy
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Could this be the problem? The next line in nph-build reads:

}
if ($dir !~ m,^[\w\d$chrs]+$,) {
&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, _, / and -.");
}

Should that line also be modified? Or is that what I'm already doing with the first two changes? Anyone have any thoughts on this?

Thanks for all the help,
Kathy

Quote Reply
Re: Bobise: Using special characters in categories In reply to
Sweet! That was it. In case anyone else wants to use special characters in categories--and avoid all the same trial-and-error Smile--this is what I had to change to use the characters , & ' and @:

In category.def, under %db_def, I changed

'^[\w\d/_-]+$'],

to

'^[\w\d,\&\'\@/_-]+$'],

In nph-build.cgi, under sub build_check_dir, I changed

my $chars = quotemeta ("/_-");

to

my $chrs = quotemeta (",\&\'\@/_-");

In the next line (or so), I changed

if ($dir !~ m,^[\w\d$chrs]+$,) {
&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, /, _ and -.");

to

if ($dir !~ m,^[\w\d$chrs]+$,) {
&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, \,, \&, \', \@, _, / and -.");

It's working beautifully, and I am one happy camper--thanks to the great people on this board.

Kathy
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Hm. Is that what I did? Oh, well. As you said, it works. And with the way I've been bumbling around, it might better to just leave things as there. Glad you replied, though, or other people who are new to this might get the wrong idea, think I know what the heck I'm talking about and start changing their error messages, too. Smile I do think the first part that you and Robbo suggested really works, though.
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Kathy,

I know what you mean. People think I know what I'm talking about as well but there is a whole bunch I do not know. While I've been programming since 1977 in a variety of languages, I've only recently started using Perl on a regular basis. This Links script has taught me a lot but I still have not written a complete Perl program on my own because there is a lot I don't know how to do (yet). I am just very good at analyzing and debugging programs and, for some unknown reason, have a knack for remembering what I learn. Now if I could just remember where I put my car keys, things would be great!

[This message has been edited by Bobsie (edited June 02, 1999).]
Quote Reply
Re: Bobise: Using special characters in categories In reply to
 
Quote:
In the next line (or so), I changed

if ($dir !~ m,^[\w\d$chrs]+$,) {
&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, /, _ and -.");

to

if ($dir !~ m,^[\w\d$chrs]+$,) {
&cgierr ("Invalid characters in category name: $dir. Must contain only letters, numbers, \,, \&, \', \@, _, / and -.");

I hate to say this, but all you did was change the error message. Nothing in the condition being checked in the if statement was changed, so there is really no effect on the outcome. If the result of the condition check in the "if" statement was false, then the error message wouldn't even display anyway. I think it was OK to begin with, but, what the hey! Who am I to argue with success? Smile

Glad you got it working.
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Hi,
I still don't understand that all people try to use only categories name with reall related subjects.

I use simple categories like Sort_01...., and Sort_20.
and i use the metakeywords to be printed at every index file as like every categories name.

If anyone want to use special characters (non-english also,) for categories, he should follows bobsie's category mod.

You can have a look at this working mod at http://factory.co.kr and move to english page.
Also, check members page to adding links page view.

it looks like following;
<option value="Sort_01">Sort_01 : Live Animals
<option value="Sort_01/HS_01">Sort_01/HS_01 : Live animals
<option value="Sort_01/HS_02">Sort_01/HS_02 : Meat, edible meat offal
<option value="Sort_01/HS_03">Sort_01/HS_03 : Fish, crustaceans, molluscs, other aquatic invertebrates
<option value="Sort_01/HS_04">Sort_01/HS_04 : Dairy produce, birds' eggs, honey, other edible products ofanimal origin
<option value="Sort_01/HS_05">Sort_01/HS_05 : Other products of animal origin
<option value="Sort_02">Sort_02 : Vegetable Products
<option value="Sort_02/HS_06">Sort_02/HS_06 : Live trees, other live plants, bulbs, cut flowers, ornamental foliage
<option value="Sort_02/HS_07">Sort_02/HS_07 : Edible vegetables, roots, tubers


------------------
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Hi,

Koreags, can you tell how could you make the pulldown menu shown up non-English? Since i could only do it in the category list.

Also, i saw you page have both Korean and English version. Could you tell do you use one single database? or two, if does, how could i do?

Thanks!!

Kavis

------------------
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Hi, Kavis.
Sorry for late answer.

First, at pulldown menu I used bobsie's "category depthness mod.
and changed somewhere.
For this job i got free personal massage from very nice guy Bobsie. but i lost the mail. Please ask it for him.
I just remember "changed somewhere in category.def and ??.
It was very simple. maybe 2 lines.....

Second, I use one database for Korean & English version.
For this, You should modify site-html.pl and nph-build.cgi.
I use no real categories name at every indexpages. It just looks like real cat name.
For the printed false categories name, I use meta-key-words (for english), and meta-description (for korean).
Actually, I forgot where i modified. sorry.
if you want i can send you my modified script (english only). You may figure out by yourself.
mail to factory@factory.co.kr if you need it.


[This message has been edited by koreags (edited June 15, 1999).]
Quote Reply
Re: Bobise: Using special characters in categories In reply to
hi dear all,
i wonder if this could be used to add also
special german characters to the categories
namely äöüß,ÄÜÖ
please tell me if this would work, i know there is a mod for foreign characters, but
i cant handle it, its to complicated for me
to comprehend.
thanks in advance
love+klaus

------------------
Quote Reply
Re: Bobise: Using special characters in categories In reply to
This should work with any special characters you want to use. I would add them at the beginning of the list of allowable characters, though, as that seems to work best for some reason.
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Thanx Kathy and everyone who worked on this mod, i really was annoyed when i had to replace al the "&" in my category names with
"and" :-)

Thanx again
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Hey,

I used the above code because I needed to
add a category C_and_C++ , so added a +
sign to the code. The script let me
add the category, and it even works on the frontpage and mostly on the categroy page, but there is a small error on its actual category page.

where it lists the current subdirectory, i get something like this.

C_and_C%2B%2B_Scripts/counters

instead of

C_and_C++_Scripts/counters


Anybody know how to fix this?
Quote Reply
Re: Bobise: Using special characters in categories In reply to
I canot find this (I dont know where to add thi string)
sub build_check_dir:

$chrs = quotemeta (",&'@/_-");

can you tel me where is this



Quote Reply
Re: Bobise: Using special characters in categories In reply to
I answered your DUPLICATE THREAD already. Mad

Regards,

Eliot Lee
Quote Reply
Re: Bobise: Using special characters in categories In reply to
Someone please help I was trying to do this mod so I could use the & sign. However after adding in the code to the 2 files and then trying to build my pages when I got this:
Launching... /usr/apache/apache_1.3.6/src/modules/ssl/gcache pid=13210

I uploaded my original 2 files, however the problem has not fixed itself. You can see my nph-build.cgi here

http://www.2-seek.com/nph-build.txt

Quote Reply
Re: Bobise: Using special characters in categories In reply to
i don't see why you can't run the categories field through a browser decode routine, like the one in translate.cgi

Quote Reply
Re: Bobise: Using special characters in categories In reply to
In the sub build_check_dir in the nph-build.cgi file.

Regards,

Eliot Lee
Quote Reply
Re: Bobise: Using special characters in categories In reply to
You have NOT added the correct codes in the sub build_check_dir routine in the nph-build.cgi...As I have stated a few times in this forum, you need to replace the following codes in this sub:

Code:

if ($dir !~ m,^[\w\d$chrs]+$,) {


with the following codes:

Code:

if ($dir !~ m,[\w\d/_\&/$chrs]+$,) {


Regards,

Eliot Lee
> >