Templates

How do I stop search results highlighting from breaking my item titles?

Scenario:
"In my short template under the 'Highlight' section I have the following code:

<span class="highlight" style='background-color:yellow'>\0</span>

But when I search for something and there is a match in the title of my items, the item title displayed in the search results is weird. "

Solution:
Change the search highlighting html code to the following:

<span class='highlight' style='background-color:yellow'>\0</span> 

Note the single quote. The problem occurs when the search term appears in the title attribute of a html link so the highlight span will be applied on it. This has the effect of the extra double quote ending the title attribute and messing up the rest of the html behind it.

Original forum thread (thanks, ftruscot!):
http://forum.nucleuscms.org/viewtopic.php?t=12389

section: Templates | submitted by Leng on 2006.Sep.02 | 3819 views

item rate
Total votes: 2 - Rating: 7.50

Please tell us how useful this answer was to you (0 = useless, 10 = very very helpful):

10