A rzeczywiście...
tylko bądź tu mądry i wykorzystaj ten kod. Moja znajomość w.r chyba nie wystarcza.
Kod
function phpbb_preg_quote($str, $delimiter)
{
$text = preg_quote($str);
$text = str_replace($delimiter, '' . $delimiter, $text);
return $text;
}
//
// Was a highlight request part of the URI?
//
$highlight_match = $highlight = '';
if (isset($HTTP_GET_VARS['highlight']))
{
// Split words and phrases
$words = explode(' ', trim(htmlspecialchars(urldecode($HTTP_GET_VARS['highlight']))));
for($i = 0; $i < sizeof($words); $i++)
{
if (trim($words[$i]) != '')
{
$highlight_match .= (($highlight_match != '') ? '|' : '') . str_replace('*', 'w*', phpbb_preg_quote($words[$i], '#'));
}
}
unset($words);
$highlight = urlencode($HTTP_GET_VARS['highlight']);
}
//
// Highlight active words (primarily for search)
//
if ($highlight_match)
{
// This was shamelessly 'borrowed' from volker at multiartstudio dot de
// via php.net's annotated manual
$message = str_replace('"', '"', substr(preg_replace('#(>(((?>([^><]+|(?R)))*)<))#se', "preg_replace('#b(" . $highlight_match . ")b#i', '<span style="color:#" . $theme['fontcolor3'] . ""><b>1</b></span>', '0')", '>' . $message . '<'), 1, -1));
}
To chyba cały kod, za to odpowiedzialny