1
Hi all,
I've been hacking the Glossary/Glossaire module. As it stands right now, I've added an extra row in the table for 'related terms'. When an entry is displayed, these related terms are automatically hyperlinked (as a search term).
However, what I'd like to do is this: rather than add related terms for each entry, I want to automatically link up words within a definition if they already exist in the database. So if my database has 100 terms in it, and 6 of these words are found in the definition the person is currently viewing, each of the 6 will be hyperlinked.
Here's the code I have for my 'related terms' hack ($glo_related are the related terms stored in the db, separated by commas):
$related_terms = preg_split('/,/', $glo_related, -1, PREG_SPLIT_NO_EMPTY);
$zz=count($related_terms);
for($z=0;$z<$zz;$z++){
$replacements[$z] = "<a href='".XOOPS_URL."/modules/glossaire/glossaire-rech.php?terme=".$related_terms[$z]."&type=1'>".$related_terms[$z]."</a>";
$glo_definition = str_replace($related_terms[$z], $replacements[$z], $glo_definition);
}
Any ideas on how this can be modified to do what I want it to? The terms are listed in the 'nom' row in the db.
Thanks for any assistance!
Brad