Hi:
Well.. I have a stumper.... I need a Highlight tag that is a bit smarter than the ones I have seen.
Basically I have an index search that allows you to search multiple words... and I highlight the matches throughout the results.
I have many methods that work great if you only have one feild keyword.... It will wrap a font tag around the word and add a style to highlight it. The problem is when it loops through the same paragraph to search for the second word.. to highlight it... the problem lies in that I have just introduced new characters into the description.. namely the font tag "<font color=red style=background:yellow;".
The problem is it now tries to highlight ant matches thaty might be in those new letters... like background... it thinks it is part of the description.. and if I had a keyword called background... it matches and adds yet another font tag around it.. thus breaking it and shoing partial font tags in the results.
Does this make sense...
If not I can show you an example:
The custom tag that loops around it is this:
Any ideas to do an exception to not highlight the <font> tag info, if it contains a keyword match?
Please let me know if you have a smart- smart results highlighter... all I see on MM exchange dont do it for me.
Thanks
Well.. I have a stumper.... I need a Highlight tag that is a bit smarter than the ones I have seen.
Basically I have an index search that allows you to search multiple words... and I highlight the matches throughout the results.
I have many methods that work great if you only have one feild keyword.... It will wrap a font tag around the word and add a style to highlight it. The problem is when it loops through the same paragraph to search for the second word.. to highlight it... the problem lies in that I have just introduced new characters into the description.. namely the font tag "<font color=red style=background:yellow;".
The problem is it now tries to highlight ant matches thaty might be in those new letters... like background... it thinks it is part of the description.. and if I had a keyword called background... it matches and adds yet another font tag around it.. thus breaking it and shoing partial font tags in the results.
Does this make sense...
If not I can show you an example:
The custom tag that loops around it is this:
Code:
Partial code... but you get the idea... I add some info around any matches.. an opentag like: <font color=red style=background:yellow;> and a closetag like: </font>
The substring list is the list of keywords to highlight.
<CFLOOP Index=Substring
List="#SubStringList#">
<CFSET CurrentChar=1>
<CFSET Start=1>
<CFLOOP CONDITION="START ge 0">
<CFSET Substring=Trim(Substring)>
<CFSET Start=#FindNoCase(Substring, String, CurrentChar)#-1>
<CFIF Start ge 0>
<CFSET End=#Start# + #Len(SubString)# >
<CFSET String=Insert(CloseTag,String,End)>
<CFSET String=Insert(OpenTag,String,Start)>
<CFSET CurrentChar=End + Len(OpenTag & Closetag)>
</cfif>
</cfloop>
</cfloop>
Any ideas to do an exception to not highlight the <font> tag info, if it contains a keyword match?
Please let me know if you have a smart- smart results highlighter... all I see on MM exchange dont do it for me.
Thanks