Hey, I need some help.
I am trying to parse a forum post using php, but it parses it everytime it
sees the letter, not the thing in quotes. Any help?
function bbcodereplace($subject){
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
// and white space. It will also convert some
// common HTML entities to their text equivalent.
$search = array ("[b]", // Bold
"[u]", // Underline
"[i]", // Italics
"[/b]", // Bold Close
"[/u]", // Underline Close
"[/i]"); // Italics Close
// '@&(gt|#62);@i',
// '@&(nbsp|#160);@i',
// '@&(iexcl|#161);@i',
// '@&(cent|#162);@i',
// '@&(pound|#163);@i',
// '@&(copy|#169);@i',
// '@&#(\d+);@e'); // evaluate as php
$replace = array ('<b>',
'<u>',
'<i>',
'</b>',
'</u>',
'</i>');
// '>',
// ' ',
// chr(161),
// chr(162),
// chr(163),
// chr(169),
// 'chr(\1)');
return preg_replace($search, $replace, $subject);
}
PLEASE NOTE: This is for a phpBB forum, not vBulliten or
InvisionPowerBoard
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php