Gossamer Forum
Home : Products : Links 2.0 : Customization :

Mod: Automatic Duplicate URL Check

Quote Reply
Mod: Automatic Duplicate URL Check
Trying to use the above mod,

It works from the add.html template, when i try submiting from the add_error.html mod i get the following message.

"Unkown Tag: Title"
(comes from the add.cgi)

Code i have inserted is;

db_utils.pl -

if ($rec{'process_form'}) { # don't need to worry about duplicate if modifying (unless, however, URL is changed!)
$testURL = $in{'URL'};
$testURL =~ tr/A-Z/a-z/;
$testURL =~ s/www\.//; # disregards www.
$testURL =~ s/\///g; # ignores slashes
$testURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
open (DB, "<$db_file_name") or &cgierr("error in validate_records. unable to open db file: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already listed!");} # so let's add it as an error
}
close DB;
open (DB, "<$db_valid_name") or &cgierr("error in validate_records. unable to open db file: $db_valid_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
$dataURL = $data[$db_url];
$dataURL =~ tr/A-Z/a-z/;
$dataURL =~ s/www\.//; # disregards www.
$dataURL =~ s/\///g; # ignores slashes
$dataURL =~ s/index\.html|index\.htm//; # disregards index.htm(l)
if ($dataURL eq "$testURL") {push(@input_err, "duplicate URL error - already submitted!");} # so let's add it as an error
}
close DB;
}

add.html

<input type="SUBMIT" value="SUBMIT" name="process_form">

add_error.html

<input type="SUBMIT" value="SUBMIT" name="process_form">

Any Ideas?

Help would be greatly appreciated.

Thanks
Michael

Quote Reply
Re: Mod: Automatic Duplicate URL Check In reply to
Add Title => $Title, as a global in site_html_templates.pl

Paul Wilson. Shocked
(Dont blame me if I'm wrong!)
Quote Reply
Re: Mod: Automatic Duplicate URL Check In reply to
I've done that, then i try to submit i get Unkown Tag: URL

I will add url to the globals as well... see if that works

Thanks
Michael

Quote Reply
Re: Mod: Automatic Duplicate URL Check In reply to
I have added URL and Description, now i try adding

%globals = (
date => &get_date,
time => &get_time,
Title => $Title,
URL => $URL,
Description => $Description,
Contact Name => $Contact Name,
db_cgi_url => $db_cgi_url,
build_root_url => $build_root_url,
site_title => $build_site_title,
css => $build_css_url,
banner => ''
);

It doesnt work, i've tried putting underscores between contact_name, which doesnt work either.

Error including libraries: syntax error at /usr/home/pump100/public_html/links/cgi-bin/admin/site_html_templates.pl line 37, near "Contact Name"

Make sure they exist, permissions are set properly, and paths are set correctly.

If contact name is not added it still comes up with...

Unkown Tag: Contact Name

Thanks
Michael



Quote Reply
Re: Mod: Automatic Duplicate URL Check In reply to
Hmmm i just went to build the list, and it worked, then went to view my pages, and no links showed up... had to remove all the additions to the site_html_template.pl globals, and build again to show up?

*help me!*

Michael

Quote Reply
Re: Mod: Automatic Duplicate URL Check In reply to
You need to first VALIDATE the added links and then REBUILD your directory Build All.

Regards,

Eliot Lee