PHP Classes

Only linking 1st instance of phrase

Recommend this page to a friend!

      Thesaurus tooltip  >  All threads  >  Only linking 1st instance of phrase  >  (Un) Subscribe thread alerts  
Subject:Only linking 1st instance of phrase
Summary:Only linking 1st instance of phrase
Messages:2
Author:kj
Date:2007-07-31 17:36:05
Update:2007-08-08 10:35:50
 

  1. Only linking 1st instance of phrase   Reply   Report abuse  
Picture of kj kj - 2007-07-31 17:36:05
Is it possible to make it so that only the first instance of a phrase gets linked? I am using this as a glossary, and on one page I have the same phrase several times. It would speed up page load considerably if I could get it to only link the first instance. Thanks!

  2. Re: Only linking 1st instance of phrase   Reply   Report abuse  
Picture of Dmitry Sheiko Dmitry Sheiko - 2007-08-08 10:35:50 - In reply to message 1 from kj
You can change applyTerm function of thesaurus.js. This function checks if given term exists in specified string (part of analysing text). So you declare an array and put there terms when they are presented in the string. Then you check in the begin of function body if given term exists in the array. If it is presented in the array you cancel function processing and the system will follow to the next term witout highlighting of the term for the second time in the text.