Displaying text surrounding keywords

Hello, can anyone help me display the text surrounding keywords found within text?
A sketch of my current setup is here: http://farmville.byethost8.com/

I’m trying to get something like where, for example, if a user searches “foo”
A result’s description might read
[size=18pt]Page Name[/size]
… bla bla bla foo bla bla bla…"

Thanks! :slight_smile:

Never mind, I found a way - here it is for anyone who might stumble upon this…



$rep=’’ . $terms . ‘’;
$terms=ereg_replace("[^A-Za-z0-9-]", “”, $_POST[‘search’]);

str_replace($terms, $rep, mb_substr($list,stripos($list, $terms),170));

Sponsor our Newsletter | Privacy Policy | Terms of Service