Witam,
zacząłem robić sobie własne bbcode, lecz mam problem przy znaczniku
[/PHP]
[php]<?PHP
function BBCode($tekst){
// $tekst = nl2br($tekst);
$tekst = preg_replace("#\[b\](.*?)\[/b\]#si",'<b>\\1</b>',$tekst); $tekst = preg_replace("#\[i\](.*?)\[/i\]#si",'<i>\\1</i>',$tekst); $tekst = preg_replace("#\[u\](.*?)\[/u\]#si",'<u>\\1</u>',$tekst); $tekst = preg_replace("#\[s\](.*?)\[/s\]#si",'<s>\\1</s>',$tekst); $tekst = preg_replace("#\[img\](.*?)\[/img\]#si",'<img src="\\1" alt="" />',$tekst); $tekst = preg_replace("#\[url\](.*?)\[/url\]#si", "<A HREF=\"http://\\1\">\\1</A>", $tekst); $tekst = preg_replace("#\[url=(.*?)\](.*?)\[/url\]#si", "<A HREF=\"http://\\1\">\\2</A>", $tekst); $tekst = preg_replace("#\[quote\](.*?)\[/quote\]#si",'<blockquote class="cytat">\\1</blockquote>',$tekst); $tekst = preg_replace("#\[code\](.*?)\[/code\]#si",'<pre>\\1</pre>',$tekst);
}
$s = "[php ]<?PHP echo 'test'; ?>[/php ]";
#echo highlight_string(stripslashes("$s"), true);
?>
nie chce mi to pokolorować składni :|