Gossamer Forum
Home : Products : Links 2.0 : Customization :

Do I have to add a new field to Category.db after installing Non_English MOD?

Quote Reply
Do I have to add a new field to Category.db after installing Non_English MOD?
Hello,
All record entries are shifted up one position when viewing more then one category record in the admin.cgi. This only happened After installing the non-English mod.!!
Please see the example below.
How should I fix this one? (add "|" into category.db or not?)...

Thank you for the help..
Eiad


ID: 20
Name: Education
Description: SUB1
Related:
Meta Description: Education Category
Meta Keywords: Universites,school,Learn
Header:
Footer:
Nonenglish: 98


ID: Business_&_Money/Training_&_Education
Name:
Description:
Related: Training and Education
Meta Description: Training,Education
Meta Keywords:
Header:
Footer: 126
Nonenglish: Health_&_Medicine/Education




Quote Reply
Re: Do I have to add a new field to Category.db after installing Non_English MOD? In reply to
Look at the adding fields to links.db FAQ in the Resource Center. Copy the script located in the linked Topic. Then change the configurations of the script to use category.def and categories.db.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Do I have to add a new field to Category.db after installing Non_English MOD? In reply to
Hmmm.... How do you run the "CREATE A NEW FIELD" script?
My site is hosted on a UNIX server, and I modified this script as Eliot said. Ok. what is the next step?
I transfered the script into my data directory. so how would I run it to create me a new field in the Categories.db.

thank you for your help
Mark.



O.K . Here is the script:
#!/usr/local/bin/perl
# -------------------------------------------
#You must EDIT YOUR category.def script BEFORE entering these variable and running this script!
$field_default = ""; #Put the default value of the new field here. Leave Blank for no default.
$new_field = "8"; #Put the new field number here.
$total_fields = "8"; #Put the last field number here.
#Change these value to match your settings
require "../db_utils.pl";
require "../category.def";

#You shouldn't have to edit below this line
#------------------------------------------
$nfm1 = $new_field - 1;

$ENV{'REQUEST_METHOD'} and (print "Content-type: text/plain\n\n");
open (DB, "<categories.db") or print "Unable to open categories database 'categories.db'. Reason: $!" and exit;
print "\tOpening output file . . .\n";
open (DBOUT, ">categories2.db") or print "Unable to open output database. Make sure data dir is chmod 777 temporarily. Reason: $!" and exit;
print "\n\n\tProcessing records\n";
while (<DB> ) {
(/^#/) and next LINE; # Skip comment Lines.
(/^\s*$/) and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@rec_in = &split_decode($_);
# Copy ID, Title, URL, Date and Category
for $i (0 .. $nfm1) {
$rec_out[$i] = $rec_in[$i];
}
# Add New Field
$rec_out[$new_field] = "$field_default";
# Copy the rest of old categories.db to new categories2.db
for $i ($new_field .. $total_fields) {
$rec_out[$i + 1] = $rec_in[$i];
}
print DBOUT &join_encode(&array_to_hash(0, @rec_out));
}
print "\tDone.\n\n";
close DB;
close DBOUT;
print "Database saved it as categories2.db.\n";
print "Change permissions back to 755 on the data directory.\n\n";
print "You must rename 'categories2.db' to 'categories.db before using with categories v2.\n";
print "It is recommend you save the original 'categories.db' before renaming.\n\n";
Quote Reply
Re: Do I have to add a new field to Category.db after installing Non_English MOD? In reply to
Uh...the next step is to upload the script to your server, change the permission of the script to 755, and then execute the script.

Pretty straightforward, like using any other cgi or perl script. Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums


[This message has been edited by AnthroRules (edited March 10, 2000).]
Quote Reply
Re: Do I have to add a new field to Category.db after installing Non_English MOD? In reply to
BINGO ... Smile
Thank you Eliot it worked perfectly..

Regards..
Mark..
Quote Reply
Re: Do I have to add a new field to Category.db after installing Non_English MOD? In reply to
You're welcome.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums