hi, ich weiß das thema gab es schon sooo oft und mich kotzt es auch an!
Aber wie immer tauchen Probleme auf mit denen man alleine net fertig wird!
Das mit [LIST] klappt nur das mit [*] nicht.
also geschrieben wird dann:
Aber wie immer tauchen Probleme auf mit denen man alleine net fertig wird!
PHP:
function bbcode($text)
{
$text = stripslashes($text);
$text = htmlspecialchars($text);
$text = preg_replace("/\[B\](.*)\[\/B\]/isU","<b>$1</b>", $text);
$text = preg_replace("/\[I\](.*)\[\/I\]/isU","<i>$1</i>", $text);
$text = preg_replace("/\[U\](.*)\[\/U\]/isU","<u>$1</u>", $text);
$text = preg_replace("/\[CENTER\](.*?)\[\/CENTER\]/isU","<center>$1</center>", $text);
$text = preg_replace("/\[URL=(.*)\](.*)\[\/URL\]/isU", "<a href=\"$1\" target=\"_blank\">$2</a>", $text);
$text = preg_replace("/\[URL\](.*)\[\/URL\]/isU", "<a href=\"$1\" target=\"_blank\">$1</a>", $text);
$text = preg_replace("/\[EMAIL\](.*)\[\/EMAIL\]/isU", "<a href=\"mailto:$1\">$1</a>", $text);
$text = preg_replace("/\[img\](.*)\[\/img\]/isU", "<img src=\"$1\" />", $text);
$text = preg_replace("/\[code\](.*)\[\/code\]/isU", "<pre>$1</pre>", $text);
$text = preg_replace("/\[COLOR=(.*)\](.*)\[\/COLOR\]/isU", "<font color=\"$1\">$2</font>", $text);
$text = preg_replace("/\[SIZE=(.*)\](.*)\[\/SIZE\]/isU", "<font size=\"$1\">$2</font>", $text);
$text = preg_replace("/\[FONT=(.*)\](.*)\[\/FONT\]/isU", "<font face=\"$1\">$2</font>", $text);
$text = preg_replace("/\[LIST=(.*)\](.*)\[\/LIST\]/isU", "<ol start=\"1\" type=\"$1\">$2</ol>", $text);
$text = preg_replace("/\[*\](.*)/isU", "<li>$1", $text);
/* Smilies */
$text = str_replace(":)","<img src=\"pics/smilies/smilie.gif\" />",$text);
$text = str_replace(":D","<img src=\"pics/smilies/biggrin.gif\" />",$text);
$text = str_replace(";)","<img src=\"pics/smilies/wink.gif\" />",$text);
$text = str_replace(":o","<img src=\"pics/smilies/redface.gif\" />",$text);
$text = str_replace(":?","<img src=\"pics/smilies/confused.gif\" />",$text);
$text = str_replace(":(","<img src=\"pics/smilies/frown.gif\" />",$text);
$text = str_replace(":P","<img src=\"pics/smilies/tongue.gif\" />",$text);
$text = str_replace(";P","<img src=\"pics/smilies/tongue2.gif\" />",$text);
$text = str_replace(":rolleyes:","<img src=\"pics/smilies/rolleyes.gif\" />",$text);
$text = str_replace(":]","<img src=\"pics/smilies/pleased.gif\" />",$text);
$text = str_replace("x(","<img src=\"pics/smilies/mad.gif\" />",$text);
$text = str_replace(":evil:","<img src=\"pics/smilies/evil.gif\" />",$text);
$text = str_replace("8)","<img src=\"pics/smilies/cool.gif\" />",$text);
$text = str_replace(":baby:","<img src=\"pics/smilies/baby.gif\" />",$text);
$text = str_replace(":happy:","<img src=\"pics/smilies/happy.gif\" />",$text);
$text = nl2br($text);
return $text;
}
Das mit [LIST] klappt nur das mit [*] nicht.
also geschrieben wird dann:
HTML:
<ol ...>
[*<li> Text
</ol>