Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jak automatycznie wstawić link
terra_kota
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 10.04.2002
Skąd: Sopot

Ostrzeżenie: (0%)
-----


mam taki problem.. robię sobie forum i pisze np odwiedź stronę http://www.malpa.goryl . adres jest zapamiętany jako tekst - i to jest normalne zachowanie.
Ale czy moge jakoś w licie wstawic autmatycznie href zeby wyswietlało się jako link? nie chce aby użytkownik musiał wpisywać <a href 'http://www.malpa.goryl> http://www.malpa.goryl </a>

Czy ktoś widzał / ma / wie jak najlepiej napisać taką funkcyjkę ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
terra_kota
post
Post #2





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 10.04.2002
Skąd: Sopot

Ostrzeżenie: (0%)
-----


no to niezle tutaj na forum to działa - moze ktoś wie jak ? (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) )
Go to the top of the page
+Quote Post
castor
post
Post #3





Grupa: Zarejestrowani
Postów: 456
Pomógł: 0
Dołączył: --

Ostrzeżenie: (0%)
-----


Kod
<?

$tmp  =  $text; //text to twoj tekst jasne nie :wink:  

  

while(ereg('(http?//)?www.[[:alnum:]/.-_&?=+%]*[[:alnum:]/-_&?=+#]{1}',  $tmp,  $found)){

      $url  =  $found[0];

      $text  =  str_replace($url,  "<A  TARGET=_blank  HREF="http://".$url."">".$url."</A>",  $text);

      $tmp  =  str_replace($url,  "",  $tmp);

  }

  

echo"$text";



?>
Go to the top of the page
+Quote Post
suy
post
Post #4





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 9.04.2002
Skąd: hajnówka

Ostrzeżenie: (0%)
-----


A jak wyciągnąć emaila (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
castor
post
Post #5





Grupa: Zarejestrowani
Postów: 456
Pomógł: 0
Dołączył: --

Ostrzeżenie: (0%)
-----


Kod
    

$temp=$text

   while  (ereg('[[:alnum:]._]*@[[:alnum:].-]*.[[:alpha:]]{2,4}', $tmp,  $found))  {

      $email  =  $found[0];

      $text  =  str_replace($email,  "<A  HREF="mailto:".$email."">".$email."</A>",  $text);

      $tmp  =  str_replace($email,  "",  $tmp);

        }  
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 23:11