Why not do something that parses the text, and put's SPAN ... tags
around the text, and use a stylesheet to highlight it?
The problem (that I can find) is that you are using eregi_replace(), which
is case-insensitive. You may need to do something like strpos() to find
the beginning and ends of the word, and using eregi_replace() to replace
the the spaces on either side of it with b and /b .
I have a killer headache right now, otherwise I'd write some code =
Sorry!
Good luck,
Ben
On Mon, 23 Jul 2001, Christian Dechery wrote:
I want to highlight some keywords in a text without losing its case.
How do I do that? I have something like the following:
$keyword=something here;
ob_start(highlight_keyword);
?
pfont face=tahoma size=2just some textbr
to get it to grab the text and highlight itbr
the keyword is right now... check it outbr
Something Here, see? it's with a different case.../font/p
?
ob_end_flush();
function highlight_keyword($buffer)
{
global $keyword;
return eregi_replace($keyword,b.$keyword./b,$buffer);
}
the problem is that it's going to give me ...bsomething here/b, see?
it's with a different case..., with a lowercased keyword... I want to
preserve the case of the found text... any ideas
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]