Hello,

I am having the search function of a CF template highlight words that a user
entered in their query.  For example, if someone searches for "test" in the
query box, it would then go through and replace the word "test" with a span
tag with class "highlight" in order to highlight it.  The following code is
how I did it:

REReplaceNoCase(threads.message, "(#query#)","<SPAN
CLASS='highlight'>1</SPAN>", "ALL");

After implementing this feature, I made it so that the CF template takes all
the words in the string "query", and makes and array out of it called
"keywords", with each element of the array being a different word from the
original string "query."  To make it do that the search/highlighting
function worked with the new code, I did a CFLOOP of the REReplaceNoCase
function, each time making the word to change a different element in the
keyword array.  The only problem was, if someone searched for something with
the words "span" or "highlight" or any part of those words, the second time
the loop went around it would replace the things it itself added into the
message, thus making it so that the highlighting of the first word in the
keywords array wouldn't work, and would even display partial HTML around it.
Is there a way to make the REReplaceNoCase function search through a message
and replace any word that appears in a certain array rather than replacing a
single word?

Thanks,
Brent

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to