Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Addding new fields to Links

Quote Reply
Addding new fields to Links
Hi

I am looking for a way to add additional fields to Links. I have browsed through the discussions but didn't see any solution.

Any help is greatly appreciated.

Quote Reply
Re: Addding new fields to Links In reply to
You looked? Really? Wink I guess you didn't look too hard.

It's in the FAQ section of the resource center. Follow the link at the top of the page that lists all the subject lines for this board.

Phoenix
Quote Reply
Re: Addding new fields to Links In reply to
Heres a small script that will add pipes to the end of your existing database.

IMPORTANT for some reason this board puts a space between the pipe | symbols below, so you will have to remove the spaces between ALL pipes | in the script, lines 3,4, and 8.


It will work fine, but I recommend you make an additional back up of your links.db file beforehand. (always good practise)

Change the path to perl to yours -upload it to the same directory as your other cgi`s i.e. search.cgi etc.
and chmod executable, copy your links.db into same directory (so your original in the data directory acts as backup)- when run from your browser it will create another file called links2.db and copies over your data and adds 5 pipes to the end of each record i.e.
print FILE2 "$_| | | | |\n"; or as many as you require just remove or add them, it can also add text if you want a new field to be all no`s or yes`s for all records.
Open your data file in a text editor check all is okay.
Rename it to links.db and place in your data directory.
Here it is..
Code:
#!/perl/bin/perl -w

open (FILE, "links.db") | | die $!;
open (FILE2, ">links2.db") | | die $!;

while (<FILE> ) {
chomp;
print FILE2 "$_| | | | |\n";
}

close (FILE);
close (FILE2);

hope that helps.
chmod


[This message has been edited by chmod (edited August 01, 1999).]

[This message has been edited by chmod (edited August 01, 1999).]

[This message has been edited by chmod (edited August 01, 1999).]