skip navigation

www.Hilands.com


Content:: PHP - BB 2 HTML Function

PHP - BB 2 HTML Function

BB 2 HTML is a function that will convert common bb code [b],[i],[u], etc to html code. This is a very simple version and could use some fine tuning and half parsing. For proper display we realy on the input user to close tags properly. Some error checking in the future would be nice. This should help with a solution to some types of cross site scripting.
The majority of this code is from http://elouai.com

Our first step of course is including the file.
if (file_exists("./inc/bb2html.func.inc.php")) { include ("./inc/bb2html.func.inc.php"); } else { echo 'failed to open bb2html.func.inc.php'; exit;}
This portion is a sample string with BB code in it. The string is being parsed by the bb2html function and then echo'ed out for print.
$strConvert = '[b]this is bold[/b]
and here is some [i]italic[/i]';
$strConvert = bb2html($strConvert);
echo $strConvert;



bb2html.func.inc.2007122700.zip
Download 2,305 bytes
MD5 - f02621187ef8381b4f5b85fad82b1edd *bb2html.func.inc.2007122700.zip
Last Modified: 2012-10-21