View Single Post
Old 11-16-2003, 08:35 AM   #1
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Version 1.6.3 Highlight Bug & Fix

Hi. The version 1.6.3 highlight fix to fix the version 1.6.2 highlight problem with exact words has a bug.

The bug is that with version 1.6.3, if you search on say 'php' using words begin or any words part, you will see something like 'blah blah phpdigHighlight">php' in the search results.

To fix this in version 1.6.3 do the following.
  1. In robot_functions.php find:
    PHP Code:
    //replace any group of blank characters by an unique space
    $text ereg_replace("[[:blank:]]+"," ",eregi_replace("<[^>]*>","",$text)); 
    and right after add:
    PHP Code:
    //strip characters used in highlighting
    $text str_replace("^#_","",str_replace("_#^","",$text)); 
  2. In phpdig_functions.php replace the phpdigHighlight function with the following:
    PHP Code:
    function phpdigHighlight($ereg='',$string='')
    {
    if (
    $ereg) {
    //    return @eregi_replace($ereg,"\\\\1<span class=\"phpdigHighlight\">\\\\2</span>\\\\3",$string);
        
    $string = @eregi_replace($ereg,"\\\\1<^#_>\\\\2</_#^>\\\\3",@eregi_replace($ereg,"\\\\1<^#_>\\\\2</_#^>\\\\3",$string));
        
    $string str_replace("^#_","span class=\"phpdigHighlight\"",str_replace("_#^","span",$string));
        return 
    $string;
    }
    else {
        return 
    $result;
    }

  3. In search_function.php there are four places where the following occurs:
    PHP Code:
    phpdigHighlight($reg_strings,phpdigHighlight($reg_strings
    In these four places, remove the following from each line:
    PHP Code:
    // the first instance of phpdigHighlight($reg_strings,
    // and also one ending ) to match parentheses 
Remember to remove any "word" wrapping in the above code.

EDIT: PhpDig version 1.6.4 includes this fix. See the Changelog for more details.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote