![]() |
![]() |
|
![]() |
![]() |
|
Programmierung Rat & Tat für Programmierer |
![]() |
|
Themen-Optionen | Ansicht |
![]() |
#1 |
Meisteroptiker
![]() |
![]() also mal zur situation ich schicke im nem html formular daten zu ner mysql datenbank der text kommt in ein "blob" type feld
das funkt auch das is das gute hehe aber was ich jetzt wisse wollte ob es einen einfachen weg gibt die links ie: "http://www.xxx.com" als echten link auszugeben wenn man den datensatz von der datenbank holt? so wie das auch in diesem board is
____________________________________
©Sliver Productions http://www.sol.at/past/ http://www.lunchgen.com http://optik.dyns.cx http://sliver.hypermart.net/script/ |
![]() |
![]() |
![]() |
#2 |
Senior Member
![]() Registriert seit: 22.05.2002
Beiträge: 155
|
![]() dann holst du dir daten aus der db zb: "www.xxx.at" und dann willst an link draus machen ...
saug dir deine daten in eine variable und gib sie mit dem link aus, zb: print "das ist der link"; und ich glaub blob als datenfeld is a bissal groß für an link ![]() nimm char(100) oder so in dem bereich. Gruß |
![]() |
![]() |
![]() |
#3 |
Meisteroptiker
![]() |
![]() ops wieder ned alles geschrieben ie des eintrag is so
"hey das is a coole seite http://www.xxx.com/ <-- schauts euch das an" und da dann an link draus machen
____________________________________
©Sliver Productions http://www.sol.at/past/ http://www.lunchgen.com http://optik.dyns.cx http://sliver.hypermart.net/script/ |
![]() |
![]() |
![]() |
#4 |
Inventar
![]() Registriert seit: 24.09.2001
Beiträge: 7.335
|
![]() Code:
<html> <head> <title>Test</title> </head> <body> <?php $t = "hey das is a coole seite http://www.xxx.com/ <-- schauts euch das an"; echo preg_replace( "/((www\.|http:\/\/).*?)\s/", "<a href=\"$1\" target=\"_new\">$1</a> ", $t) . " \n"; $t = "hey das is a coole seite www.xxx.com <-- schauts euch das an"; echo preg_replace( "/((www\.|http:\/\/).*?)\s/", "<a href=\"$1\" target=\"_new\">$1</a> ", $t) . " \n"; ?> </body> </html>
____________________________________
Weiterhin zu finden auf http://martin.leyrer.priv.at , http://twitter.com/leyrer , http://www.debattierclub.net/ , http://www.tratschen.at/ und via Instant Messaging auf Jabber: m3 <ät> cargal.org . |
![]() |
![]() |
![]() |
#5 |
Meisteroptiker
![]() |
![]() @_m3 !!! ich danke dir hehe funkt supergut
____________________________________
©Sliver Productions http://www.sol.at/past/ http://www.lunchgen.com http://optik.dyns.cx http://sliver.hypermart.net/script/ |
![]() |
![]() |
![]() |
#6 |
Meisteroptiker
![]() |
![]() ich hab noch was geändert
$t1 = preg_replace( "/((www\.|http:\/\/).*?)\s/", "<a href=\"http://$1\" target=\"_new\">$1</a> ", $t) . " \n"; echo str_replace("http://http://","http://",$t1); weil wenn "www.cool.at" hat er versucht http://meinhost/test/www.cool.at draus zu machen jetzt tut er immer das http:// dazu und wenns doppelt is halt einmal wieder weg ![]() ![]()
____________________________________
©Sliver Productions http://www.sol.at/past/ http://www.lunchgen.com http://optik.dyns.cx http://sliver.hypermart.net/script/ |
![]() |
![]() |
![]() |
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
|
|