Mailinglisten-Archive |
> > $content = preg_replace('#(\n{3,})#s',"\n\n",$content); > > $content = preg_replace('#[\r\n]{3,}#s',"\n\n",$content); > > muss gehen. YO! jetzt geht’s ;-) dazu kam noch ein kleiner Fehler bei mir ... für die es interessiert hier der Gesamte Codeschnipsel um aus einem "formatierten" HTML-Quellcode eine brauchbare Text-Ansicht zu bekommen: function un_htmlentities ($string) { global $trans_tbl; $r = strtr($string,array('„' => '"', '“' => '"', chr(132) => '"', chr(147) => '"', "„"=> '"', "“"=> '"' )); $r = strtr($r, $trans_tbl); return $r; } [...] $replacer = array("\r" => "", "\n" => " ", "<p>" => "\n\n", "<P>" => "\n\n", "<br>" => "\n", "<BR>" => "\n", "<br />" => "\n", "<h1>" => "\n\n", "<H1>" => "\n\n", "<h2>" => "\n\n", "<H2>" => "\n\n", "<h3>" => "\n\n", "<H3>" => "\n\n", " " => " " ); $content = trim(strip_tags(un_htmlentities(strtr($content,$replacer)))); $lines = explode("\n",$content); $content = ''; foreach($lines as $line) { $content .= trim($line)."\n"; } $content = preg_replace("#[\\r\\n]{3,}#s","\n\n",$content); [...] > kiri mfg Andreas
php::bar PHP Wiki - Listenarchive