Forum Moderators: coopster
My results page displays a set number of results per page and allows users to jump to any page they want, aswell as prev, next etc
This part is working fine.
I am now trying to improve the script by highlighting search terms that appear on the results page. My code is as follows:
if(!isset($search_string)) { $search_string = $_POST['search_string']; }
function callback($buffer) {
global $search_string;
// surround search item items with highlight class
return (ereg_replace($search_string, "<span class='highlight'>$search_string</span>", $buffer));
}
ob_start("callback");
// Code to display results and pagination goes here
...............................
ob_end_flush();
This works fine on the first page, results show ok with the search term highlighted. But when I click next page it takes an age to load and all I get where the results should be displayed is the actual source code. The results are there but so is all the code!
I am at a loss as what to do and how to fix it, any help well appreciated,
Thanks