MyBB Community Forums

Full Version: Highlighted search results..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
It's okay, at least someone else is noticing this so it's not just meToungue.
		$find = "#(^|>)([^<]*)(".preg_quote($word, "#").")#i";
		$replacement = "$1$2<span class=\"highlight\">$3</span>";
Appears to be a number of problems with that actually, such as breaking HTML entities as well.

A cheap fix could be to make the spans not have a border, thus stacked spans don't appear to be stacked... Won't fix the issue with HTML entities however (write another replacement for that?).
Bump...
(2009-02-20, 10:23 AM)Tom Loveric Wrote: [ -> ]Bump...

As a staff member, you should you already know how busy we are. Bumping will not accomplish anything and you should cease from doing that in the future.
Suggested fix. Find in inc/functions.php:

function build_highlight_array($terms)
{

add after

global $mybb;

if($mybb->settings['minsearchword'] < 1)
{
	$mybb->settings['minsearchword'] = 3;
}

Find in the same file:

foreach($split_words as $word)
{
	if(!$word)
	{
		continue;
	}
	$words[] = trim($word);
}

replace with

foreach($split_words as $word)
{
	if(!$word || strlen($word) < $mybb->settings['minsearchword'])
	{
		continue;
	}
	$words[] = trim($word);
}

because that is the minimum limit for a word when searching otherwise it just ignores the word. We should ignore it as well.

(more fix coming later)
Pages: 1 2