Mailinglisten-Archive |
Durch reguläre ausdrücke kannst du es relativ leicht machen, jedoch
würde ich aufgrund der performance bereits beim eintrag in die datenbank
die strings in links umwandeln.
Hier ne funktion dazu:
function rw_repl($text){
$text_hold=explode("\n",$text);
for ($i=0;$i<count($text_hold);$i++){
$hold_word=explode(" ",$text_hold[$i]);
for ($n=0;$n<count($hold_word);$n++) {
if (substr($hold_word[$n],0,4)=="http") {
$hold_word[$n]="<a
href='".$hold_word[$n]."' target='_blank'>".$hold_word[$n]."</a>";
}
}
$text_hold[$i]=implode(" ",$hold_word);
}
$text=implode("\n",$text_hold);
$text=nl2br($text);
return $text;
}
da wird jeder text, der mit http anfängt in einen link umgewandelt
beste grüße
Kilian
php::bar PHP Wiki - Listenarchive