Gossamer Forum
Home : Products : Links 2.0 : Customization :

Re: [Elke] Multi category and Link templates

Quote Reply
Re: [Elke] Multi category and Link templates In reply to
Something like this should work;

Code:
#!/usr/bin/perl
print "Content-type: text/html \n\n";

# get the old data in an array
open(IN, "links.db") || &error("unable to open data file. Reason: $!");
@data = <IN>;
close(IN);

# open the new data file..
open(NEW, "links.db.new") || &error("unable to open data file. Reason: $!");

foreach (@data) {

chomp;

my ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14) = split("|", $_);

if ($7 =~ /.gif/) { $15 = "|gif"; }
if ($7 =~ /.swf/) { $15 = "|flash"; }

print NEW "$_$15\n";

print "Added: $_$15 <BR>";

}

# shut the new data file...
close(NEW);


sub error() {

my $error = shift;

print $error;

}

I'm not sure if the syntax is right in some places...as I havn't written a Perl script in quite a few weeks Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy.: Apr 13, 2002, 5:11 AM
Subject Author Views Date
Thread Multi category and Link templates Elke 6949 Apr 12, 2002, 10:38 AM
Thread Re: [Elke] Multi category and Link templates
Andy 6854 Apr 12, 2002, 10:49 AM
Thread Re: [Andy.] Multi category and Link templates
Elke 6836 Apr 12, 2002, 12:13 PM
Thread Re: [Elke] Multi category and Link templates
tandat 6807 Apr 12, 2002, 6:45 PM
Thread Re: [tandat] Multi category and Link templates
Elke 6815 Apr 13, 2002, 12:57 AM
Thread Re: [Elke] Multi category and Link templates
Andy 6824 Apr 13, 2002, 2:37 AM
Thread Re: [Andy.] Multi category and Link templates
Elke 6762 Apr 13, 2002, 4:19 AM
Thread Re: [Elke] Multi category and Link templates
Andy 6793 Apr 13, 2002, 4:38 AM
Thread Re: [Andy.] Multi category and Link templates
Elke 6798 Apr 13, 2002, 4:51 AM
Thread Re: [Elke] Multi category and Link templates
Andy 6789 Apr 13, 2002, 5:06 AM
Thread Re: [Andy.] Multi category and Link templates
Paul 6779 Apr 13, 2002, 5:20 AM
Thread Re: [Paul] Multi category and Link templates
Andy 6792 Apr 13, 2002, 5:35 AM
Post Re: [Andy.] Multi category and Link templates
Paul 6793 Apr 13, 2002, 5:43 AM
Thread Re: [Andy.] Multi category and Link templates
Elke 6772 Apr 13, 2002, 5:54 AM
Post It works!!!
Elke 6779 Apr 13, 2002, 8:22 AM