1
BradM
Need coding help for Glossary hack
  • 2003/12/22 19:45

  • BradM

  • Just popping in

  • Posts: 78

  • Since: 2003/8/14


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, -1PREG_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

2
BradM
Re: Need coding help for Glossary hack
  • 2003/12/28 2:35

  • BradM

  • Just popping in

  • Posts: 78

  • Since: 2003/8/14


Well I still haven't had much luck with this... are there any good MySql tutorial sites out there? Basically I have to figure out a way to build a list of all the terms currently in the database, then search through the current definition for all the words in the list, and replace them with links to the terms themselves... It sounds relatively easy to do, I'm just stumbling with the code right now.


Brad

3
BradM
Re: Need coding help for Glossary hack
  • 2004/1/8 6:31

  • BradM

  • Just popping in

  • Posts: 78

  • Since: 2003/8/14


Any ideas for this? I'm going to attempt to come up with something this weekend, and I'm not sure if there is enough beer and/or coffee in my apartment to stem my "creativity" for this one!


Brad

Login

Who's Online

152 user(s) are online (91 user(s) are browsing Support Forums)


Members: 0


Guests: 152


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits