problem mit script

  • Ersteller Jens Vogelgesang
  • Erstellt am
J

Jens Vogelgesang

Guest
hallo ich habe folgendes script erstellt möchte jetzt aber das wenn man
laugh.gif
eingibt das auch ein lachendes smilie erscheint was muss ich jetzt im script ändern?

CODE function txt2html($txt) {
$patterns = array ( "/(http\:\/\/[^\s]+)/i",
"/(ftp\:\/\/[^\s]+)/i",
"/(mailto\:([^\s]+))/i",
"/\:\)+/i",
"/\:\-\)+/i",
"/\;\)+/i",
"/\;\-\)+/i",
"/\:\|/i",
"/\:\-\|/i",
"/\:\(+/i",
"/\:\-\(+/i",
"/\*(.+)\*/i",
"/\_(.+)\_/i",
"/\r/i");
$replace = array ( "<a href=\"\\1\" target=\"_blank\">\\1</a>",
"<a href=\"\\1\" target=\"_blank\">\\1</a>",
"<a href=\"\\1\" target=\"_blank\">\\2</a>",
"<img src=\"img/sch1.gif\" width=\"50\" height=\"50\" alt=\":)\">",
"<img src=\"img/sch2.gif\" width=\"50\" height=\"50\" alt=\":-)\">",
"<img src=\"img/sch3.gif\" width=\"50\" height=\"50\" alt=\";)\">",
"<img src=\"img/sch4.gif\" width=\"50\" height=\"50\" alt=\";-)\">",
"<img src=\"img/sch5.gif\" width=\"50\" height=\"50\" alt=\":|\">",
"<img src=\"img/sch6.gif\" width=\"50\" height=\"50\" alt=\":-|\">",
"<img src=\"img/sch7.gif\" width=\"120\" height=\"100\" alt=\":(\">",
"<img src=\"img/sch8.gif\" width=\"50\" height=\"50\" alt=\":-(\">",
"<img src=\"img/sch9.gif\" width=\"50\" height=\"50\" alt=\":\">",
"<b>\\1</b>",
"<i>\\1</i>",
"<br>\n");
return preg_replace($patterns,$replace, $txt);
}
?>

Danke für eure hilfe
 
wenn du mit
laugh.gif
lol mit Doppelpunkten meinst:

CODE function txt2html($txt) {
$patterns = array ( "/(http\:\/\/[^\s]+)/i",
"/(ftp\:\/\/[^\s]+)/i",
"/(mailto\:([^\s]+))/i",
"/\:\)+|\:lol\:/i",
"/\:\-\)+/i",
"/\;\)+/i",
"/\;\-\)+/i",
"/\:\|/i",
"/\:\-\|/i",
"/\:\(+/i",
"/\:\-\(+/i",
"/\*(.+)\*/i",
"/\_(.+)\_/i",
"/\r/i");
$replace = array ( "<a href=\"\\1\" target=\"_blank\">\\1</a>",
"<a href=\"\\1\" target=\"_blank\">\\1</a>",
"<a href=\"\\1\" target=\"_blank\">\\2</a>",
"<img src=\"img/sch1.gif\" width=\"50\" height=\"50\" alt=\":)\">",
"<img src=\"img/sch2.gif\" width=\"50\" height=\"50\" alt=\":-)\">",
"<img src=\"img/sch3.gif\" width=\"50\" height=\"50\" alt=\";)\">",
"<img src=\"img/sch4.gif\" width=\"50\" height=\"50\" alt=\";-)\">",
"<img src=\"img/sch5.gif\" width=\"50\" height=\"50\" alt=\":|\">",
"<img src=\"img/sch6.gif\" width=\"50\" height=\"50\" alt=\":-|\">",
"<img src=\"img/sch7.gif\" width=\"120\" height=\"100\" alt=\":(\">",
"<img src=\"img/sch8.gif\" width=\"50\" height=\"50\" alt=\":-(\">",
"<img src=\"img/sch9.gif\" width=\"50\" height=\"50\" alt=\":\">",
"<b>\\1</b>",
"<i>\\1</i>",
"<br>\n");
return preg_replace($patterns,$replace, $txt);
}
 
also kann ich jetzt alle befehle mit : doppelpunkt anfangen dann befehl dann doppelpunkt...habe ich das jetzt richtig vernommen?
 
weiß nicht ob du das kannst, meine Änderung war nur für : lol : (ohne Leerzeichen)
 
habe es hin bekommen danke für deine hilfe
 
Zurück
Oben