Home : Products : Links 2.0 : Customization :

Products: Links 2.0: Customization: Re: [Elke] Multi category and Link templates: Edit Log

Here is the list of edits for this post
Re: [Elke] Multi category and Link templates
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

Edit Log: