Jump to content

Search & HIGHLIGHT


ki

Recommended Posts

Can someone tell me whats wrong with this script? The only thing that errors is my code BBCode.

 

ERROR:

Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/tragical/public_html/index.php on line 54

 

CODE:

  function bbcode_format($var) {
   $var = str_replace('<','<',$var);
   $var = str_replace('>','>',$var);
   $search = array('/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[color=(.*?)\](.*?)\[\/color\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[url\](.*?)\[\/url\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[code\](.*?)\[\/code\]/is', '/\[quote\=(.*?)\](.*?)\[\/quote\]/is', '/\[flash\](.*?)\[\/flash\]/is');

   $replace = array('<b>$1</b>', '<i>$1</i>', '<font color="$1">$2</font>', '<u>$1</u>', '<img src="$1" />', '<a href="$1">$1</a>', '<a href="$1">$2</a>', '<table align="center" cellpadding="1" cellspacing="1" width="98%" class="code"><tr><td valign="top" width="12" class="code_Side"><img src="images/code.png"></td><td valign="top">'.highlight_string($1).'</td></tr></table>', '<br><table align="center" cellpadding="1" cellspacing="1" width="98%" class="quote"><tr><td><b>$1 said...</b></td></tr><tr><td>$2</tr></td></table><br>', '<object width="425" height="350"><param name="movie" value="$1"></param><param name="wmode" value="transparent"></param><embed src="$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>');

   $var = preg_replace ($search, $replace, $var);
   return $var;
  }

Link to comment
https://forums.phpfreaks.com/topic/39700-search-highlight/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.