WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   PHP - hyperlink im Forumscript (http://www.wcm.at/forum/showthread.php?t=138083)

weev 29.06.2004 09:47

PHP - hyperlink im Forumscript
 
hi forum,
ich hab ein forumscript gebastelt(php/mysql) und möchte nun auch hyperlinks in meiner tabelle (blob-feld) speichern und wieder als hyperlink ausgeben können. - tja, wie? –

Seppo 29.06.2004 10:34

hi!

naja du überprüfst ob es ein hyperlink ist und dann schreibst du direkt Text in dein blob-feld

ein beispiel wie du einen text auf einen hyperlink überprüfst habe ich bei den codeschnipseln auf www.php4u.net einmal gefunden

grüße
seppo

weev 29.06.2004 11:10

danke,
anbei poste ich den code:

function links($text) {
$p[0][0] = '"(( |^)((ftp|http|https){1}://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)"i';
$p[0][1] = '\\1';
$p[1][0] = '"( |^)(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)"i';
$p[1][1] = '\\1\\2';
$p[2][0] = '"([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})"i';
$p[2][1] = '\\1';
for($i=0; $i<count($p); $i++) {
$text = preg_replace($p[$i][0], $p[$i][1], $text);
}
return $text;
}
$text = "www.php4u.net ist meine Lieblingsseite.
";
$text.= "michi@php4u.net ist die Email des Authors.";
echo links($text);


Alle Zeitangaben in WEZ +2. Es ist jetzt 18:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag