Ragna: Probleme mit <br /> und textarea...

Beitrag lesen

Om nah hoo pez nyeetz, Ragna!

Ein harter Zeilenumbruch wird als "\r\n" codiert, du könntest also

str_replace('[br]', '\r\n', ...

verwenden, wenn du die Textarea befüllen möchtest.

Matthias

Wenn es als

[p][b]Zeile[br][br]Zeile[/b][/p]

in der DB steht, und ich es per

  
function bbcode_html($text)  
{  
    $text = htmlentities($text, ENT_QUOTES, "UTF-8");  
  
    # Formatierungen  
    $text = str_replace('[br]', '\r\n', $text);  
    $text = preg_replace('#\[b\](.*)\[/b\]#isU', "<strong>$1</strong>", $text);  
    $text = preg_replace('#\[p\](.*)\[/p\]#isU', "<p>$1</p>", $text);  
    $text = preg_replace('#\[i\](.*)\[/i\]#isU', "<em>$1</em>", $text);  
    $text = preg_replace('#\[u_gelb\](.*)\[/u\]#isU', "<span style=\"text-decoration: underline; color: #ffff00;\">$1</span>", $text);  
  
    $text = preg_replace('#\[color=(.*)\](.*)\[/color\]#isU', "<span style=\"color: $1\">$2</span>", $text);  
    $text = preg_replace('#\[u\](.*)\[/u\]#isU', "<span style=\"text-decoration: underline;\">$1</span>", $text);  
  
    # Links  
    $text = preg_replace('#\[url\](.*)\[/url\]#isU', "<a href=\"$1\">$1</a>", $text);  
    $text = preg_replace('#\[ url=(.*)\](.*)\[/url\]#isU', "<a href=\"$1\">$2</a>", $text);  
  
    # Zitate  
    $text = preg_replace('#\[quote\](.*)\[/quote\]#isU', "<div class=\"zitat\">$1</div>", $text);  
  
    return($text);  
}  

auslese funkioniert das auch nicht, denn es wird so im Editor-Fenster ausgegeben:

Zeile\r\n\r\nZeile

Die Umwandlung selber funzt also, aber nicht die formatgerechte Ausgabe im Editor...