I have a database of words in a glossary. If a member posts news containing one of those words, the first instance will be changed to a link and a little popup can be pulled up with a definition. The problem is that I add these from a different form on the site (for ease of adding.)
If I should add a word like 'Apple' then only Apple (not apple or APPLE, although God forbid anyone doing that) will be matched.
Here is the code I am using.
(By the way, $typist[3] is the news post itself. The script scans that post and looks for any words in it that match the glossary words.)
sub doglossary {
open (LOGT, "../gloss/glossary.txt") || &ErrorMessage;
$glossary = <LOGT>;
close (LOGT);
@glossary = split(/\|/, $glossary);
foreach $gloss (@glossary) {
$typist[3] =~ s/$gloss/<a href=\"javascript:openPopWin(\'cdb.cgi?action=glossaryread&word=$gloss\',350,200,\ \'scrollbars\')\"><span class=gloss>$gloss<\/a><\/span>/;
}
If I should add a word like 'Apple' then only Apple (not apple or APPLE, although God forbid anyone doing that) will be matched.
Here is the code I am using.
(By the way, $typist[3] is the news post itself. The script scans that post and looks for any words in it that match the glossary words.)
sub doglossary {
open (LOGT, "../gloss/glossary.txt") || &ErrorMessage;
$glossary = <LOGT>;
close (LOGT);
@glossary = split(/\|/, $glossary);
foreach $gloss (@glossary) {
$typist[3] =~ s/$gloss/<a href=\"javascript:openPopWin(\'cdb.cgi?action=glossaryread&word=$gloss\',350,200,\ \'scrollbars\')\"><span class=gloss>$gloss<\/a><\/span>/;
}