hab ein bisschen wenig zeit. Aber ich habe hier eine hässliche, aber funktionierende lösung:
PHP-Code:
function string_li_insert($s){
$pattern = '=\x95(.*)<br />=';
$zeilen = explode("\n",$s);
$text = "";
$key = 0;
$last = 0;
foreach($zeilen as $key => $z){
if(preg_match($pattern, $z, $txt)){
if($key-$last != 1){
$text = $text."<ul>\n";
}
$last =$key;
$text = $text."<li>".$txt[1]."</li>\n";
}else{
if(($key-$last == 1)and($last != 0)){
$text = $text."</ul>\n";
}
$text = $text.$z."\n";
}
}
return $text;
}
Verbesserungsvorschläge immer willkommen
danke für eure hilfe
edit: Ah ja das <br /> hat ein nl2br() vorher schon reingeflickt
Lesezeichen