tags, and leaves your textarea as-is so you can edit, etc. This also prevents <, etc., being transformed into "<" in the textarea. ;o) (or © corz.org 2004-> */ // saves typing.. $corz_root = $_SERVER['DOCUMENT_ROOT']; // do your own thing here.. @include ($corz_root.'/inc/init.php'); //@include ($corz_root.'/inc/doc-type.php'); // include the bbcode parser, very important. require ($corz_root.'/blog/inc/cbparser.php'); if (isset($_POST['cvrt-text'])) { $text = ($_POST['cvrt-text']); } else { $text = ''; } if (get_magic_quotes_gpc()) { $text = stripslashes($text); } // you posted some text.. if (isset($_POST['preview'])) { // this is the main line. // this line is all you need for basic convertion jobs. $converted = bb2html($text); // we can do some error checking, too.. if ($converted == '') $converted = "tags don't balance!\n\nin other words, you have opened a tag, but not closed it, or something..\ngo back and try again!"; } else { $converted = ''; } if (stristr(@$_SERVER['HTTP_ACCEPT'],'application/xhtml+xml')) { $doc_content = 'application/xhtml+xml'; } else { $doc_content = 'text/html'; } echo '
'; // rough tidy-up..
$in = array("
", "\n\n");
$out = array("
\n", "\n");
echo htmlentities(str_replace($in, $out, $converted)),
'