22.05.2007, 18:44
ich finde es etwas umständlich pattex aber gehen tut es ^^
[code=php]<?php
// Das
$entry = eregi_replace("\[b\]([^\[]+)\[/b\]","<b>\\1</b>",$entry);
$entry = eregi_replace("\[i\]([^\[]+)\[/i\]","<i>\\1</i>",$entry);
$entry = eregi_replace("\[u\]([^\[]+)\[/u\]","<u>\\1</u>",$entry);
$entry = eregi_replace("\[img\]([^\[]+)\[/img\]","<img src=\"\\1\" border=\"0\">",$entry);
$entry = eregi_replace("\[mail\]([^\[]+)\[/mail\]","<a href=\"mailto:\\1\">\\1</a>",$entry);
$entry = eregi_replace("\[url\]([^\[]+)\[/url\]","<a href=\"\\1\" target=\"_blank\">\\1</a>",$entry);
$entry = eregi_replace("\[url=\"([^\"]+)\"]([^\[]+)\[/url\]","<a href=\"\\1\" target=\"_blank\">\\2</a>",$entry);
// In das...
$entry = eregi_replace("\[b\]([^\[]+)\[/b\]","\\1",$entry);
$entry = eregi_replace("\[i\]([^\[]+)\[/i\]","\\1",$entry);
$entry = eregi_replace("\[u\]([^\[]+)\[/u\]","\\1",$entry);
$entry = eregi_replace("\[img\]([^\[]+)\[/img\]","",$entry);
$entry = eregi_replace("\[mail\]([^\[]+)\[/mail\]","\\1",$entry);
$entry = eregi_replace("\[url\]([^\[]+)\[/url\]","\\1",$entry);
$entry = eregi_replace("\[url=\"([^\"]+)\"]([^\[]+)\[/url\]","\\1",$entry);
// zusätze....
$entry = eregi_replace("\[code\]([^\[]+)\[/code\]","\\1",$entry);
$entry = eregi_replace("\[quote\]([^\[]+)\[/quote\]","\\1",$entry);
?>[/code]
So würde ichs machen....
[code=php]<?php
// Das
$entry = eregi_replace("\[b\]([^\[]+)\[/b\]","<b>\\1</b>",$entry);
$entry = eregi_replace("\[i\]([^\[]+)\[/i\]","<i>\\1</i>",$entry);
$entry = eregi_replace("\[u\]([^\[]+)\[/u\]","<u>\\1</u>",$entry);
$entry = eregi_replace("\[img\]([^\[]+)\[/img\]","<img src=\"\\1\" border=\"0\">",$entry);
$entry = eregi_replace("\[mail\]([^\[]+)\[/mail\]","<a href=\"mailto:\\1\">\\1</a>",$entry);
$entry = eregi_replace("\[url\]([^\[]+)\[/url\]","<a href=\"\\1\" target=\"_blank\">\\1</a>",$entry);
$entry = eregi_replace("\[url=\"([^\"]+)\"]([^\[]+)\[/url\]","<a href=\"\\1\" target=\"_blank\">\\2</a>",$entry);
// In das...
$entry = eregi_replace("\[b\]([^\[]+)\[/b\]","\\1",$entry);
$entry = eregi_replace("\[i\]([^\[]+)\[/i\]","\\1",$entry);
$entry = eregi_replace("\[u\]([^\[]+)\[/u\]","\\1",$entry);
$entry = eregi_replace("\[img\]([^\[]+)\[/img\]","",$entry);
$entry = eregi_replace("\[mail\]([^\[]+)\[/mail\]","\\1",$entry);
$entry = eregi_replace("\[url\]([^\[]+)\[/url\]","\\1",$entry);
$entry = eregi_replace("\[url=\"([^\"]+)\"]([^\[]+)\[/url\]","\\1",$entry);
// zusätze....
$entry = eregi_replace("\[code\]([^\[]+)\[/code\]","\\1",$entry);
$entry = eregi_replace("\[quote\]([^\[]+)\[/quote\]","\\1",$entry);
?>[/code]
So würde ichs machen....