Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

AutoDetect

[es] :: PHP :: AutoDetect

[ Pregleda: 2193 | Odgovora: 10 ]

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

LaMiniX

Član broj: 593
Poruke: 64
*.cg.yu

ICQ: 125470716


Profil

icon AutoDetect22.10.2001. u 20:54

Kako da napravim da skripta npr.:
http://www.site.com
prebacuje u <a href=..........></a> - znaci u HTML code
takodje i za emailove.
Znaci bilo shta da ukucava (http site, email) da prebacuje u HTML

Nadam se da ste skontali :)

Pozdrav
Sve bi bilo dobro da je pera odmah otisao na POLICIJU
22.10.2001. u 20:54 

Jbyn4e
Admin/Developer, Yunix
Zrenjanin - Beograd

Član broj: 422
Poruke: 3859
*.verat.net

ICQ: 10450578
Sajt: bio sf.co.yu


Profil

icon Re: AutoDetect22.10.2001. u 21:13
Nismo! :(((( (bar ja nisam.. ajde malo detaljnije sta zelis?)
22.10.2001. u 21:13 

LaMiniX

Član broj: 593
Poruke: 64
*.cg.yu

ICQ: 125470716


Profil

icon Re: AutoDetect22.10.2001. u 21:25
heh - sada sam i ja vidio da nisam dobro objasnio :)

Ovako - imam MemoBox ili kako vec (onaj veliki box)
I pisem sada neki text koji se kasnije prikazuje tamo nedje na siteu.
E sada - da nebi ja za link kucao stalo <a href........>..... kako da kada upisem samo http://www.site.com ili www.site.com da on prepozna da je to link i da ga preformulise u <a href.........>
Takodje i za email

Valja sada :)
Sve bi bilo dobro da je pera odmah otisao na POLICIJU
22.10.2001. u 21:25 

LaMiniX

Član broj: 593
Poruke: 64
*.cg.yu

ICQ: 125470716


Profil

icon Re: AutoDetect22.10.2001. u 21:27
Vidis kako ovdje ja samo ukucam www.site.com i on napravi link :)

Oli da nacrtam :)
Sve bi bilo dobro da je pera odmah otisao na POLICIJU
22.10.2001. u 21:27 

Jbyn4e
Admin/Developer, Yunix
Zrenjanin - Beograd

Član broj: 422
Poruke: 3859
*.verat.net

ICQ: 10450578
Sajt: bio sf.co.yu


Profil

icon Re: AutoDetect22.10.2001. u 21:34

Citat:
LaMiniX je napisao:
Vidis kako ovdje ja samo ukucam www.site.com i on napravi link :)
Oli da nacrtam :)


Crtaj :)))) hahahhaha
Sala mala, ali recimo da je nekako ovako:
Ako si textbox smestio u promenljivu recimo $text, onda je potrebno da pronadjes i zamenis tekst koji pocinje sa www i zavrsava sa razmakom sa onim sto hoces, tj. da zamenis u <a href=http://www.... >www.....</a>
isto treba da proveris i da li ima http:// ispred (dakle, da radi i za www i za http://www...). Da li postoji neko elegantnije resenje ili gotova funkcija, ne znam, sad sam jaaaaaaaaaaako umoran, ceo dan se bakcem sa jednom skriptom i vise mi je muka!

Ah da, za mail bi bilo verovatno naci @, uzeti do razmaka ispred i razmaka iza i zameniti sa mailto: ....

Uh, vise ne znam sta pricam, nemoj da se ljutis ako sam nesto lose napisao...

[Ovu poruku je menjao Jbyn4e dana 22.10.2001 u 09:36 PM GMT]
22.10.2001. u 21:34 

LaMiniX

Član broj: 593
Poruke: 64
*.cg.yu

ICQ: 125470716


Profil

icon Re: AutoDetect22.10.2001. u 21:55
hhehehehe
Aleluja - to sam i ja znao :)
Ali meni treba example :)

Pozdrav :)
Sve bi bilo dobro da je pera odmah otisao na POLICIJU
22.10.2001. u 21:55 

Dragoslav Krunić

Član broj: 225
Poruke: 1082
*.verat.net



Profil

icon Re: AutoDetect22.10.2001. u 22:12
Citat:
LaMiniX je napisao:
hhehehehe
Aleluja - to sam i ja znao :)
Ali meni treba example :)

Pozdrav :)


Ovo nije resenje ali ce ti pomoci:

man perlfaq9
Code:

 How do I extract URLs?
 
       A quick but imperfect approach is
 
           #!/usr/bin/perl -n00
           # qxurl - tchrist@perl.com
           print "$2\n" while m{
               < \s*
                 A \s+ HREF \s* = \s* (["']) (.*?) \1
               \s* >
           }gsix;
 
       This version does not adjust relative URLs, understand alternate bases, deal
       with HTML comments, deal with HREF and NAME attributes in the same tag, under-
       stand extra qualifiers like TARGET, or accept URLs themselves as arguments.  It
       also runs about 100x faster than a more "complete" solution using the LWP suite
       of modules, such as the http://www.perl.com/CPAN/authors/Tom_Chris-
       tiansen/scripts/xurl.gz program.
22.10.2001. u 22:12 

Jbyn4e
Admin/Developer, Yunix
Zrenjanin - Beograd

Član broj: 422
Poruke: 3859
*.verat.net

ICQ: 10450578
Sajt: bio sf.co.yu


Profil

icon Re: AutoDetect22.10.2001. u 22:17
Citat:
LaMiniX je napisao:
Ali meni treba example :)

Ja ne biti lenj. Ja otici na stranicu:
http://www.php.net/manual/en/function.ereg.php
Ja tamo videti:
editor@mylamb.com
01-Sep-2000 11:38
FWIW - I allow users to post URLs right on the site. However, sometimes they want the HTTP:// business. Sometimes not. Here's a little function I find handy:

function stripHTTP($url)
{
if (eregi('(^http[s]*:[/]+)(.*)', $url, $x))
return $x[2];
return $url;
}
dalje,
carlos_aT_radiumsystems_DoT_com
10-Oct-2001 03:53
Just to extend an example about stripping hyperlinks in htmls from user comments above, here it goes an regexp to find anything in href="xx", javascript included.

$regexp = "(< *[aA] *)([^>]*)([hH][rR][eE][fF] *= *)((\"[^\">]*\")|('[^'>]*')|[^> ]*)([^>]*>)";

Na strani:
http://www.php.net/manual/en/function.ereg-replace.php
IMA BAS ONO STO TI HOCES, na nekoliko mesta (razlicito):
rink@springer.cx
27-Feb-2000 12:09
Code code below will change every http://(something) reference to a hyperlink! Yay!
<pre>$it = ereg_replace("http://(([A-Za-z0-9.\-])*)([a-zA-Z0-9])", "<a href=\"\\0
\">\\0</a>",$it);</pre>
Enjoy!

Dalje,
03-Apr-2000 02:11

I wrote the following regex to convert text in hyperlinks. I think works slightly better than the one already posted.

$tmp = ereg_replace("http://(([A-Za-z0-9.\-])+)([a-zA-Z0-9])((/(([a-zA-Z0-9])*))*)((.([a-zA-Z0-9])+)*)", "<a href=\"\\0\">\\0</a>",$tmp);

, jos:
superdoc@shinbiro.com
14-Apr-2000 12:58

convert in hyperlink...how about this?

$tmp = ereg_replace("((ftp://)|(http://))(([[:alnum:]]|[[:punct:]])*)", "<a href=\"\\0\">\\0</a>",$tmp);

Ovaj je bas detaljan:
ckrempea@sfu.ca
03-Jan-2001 05:41

I've seen various notes added for turning URLs (in text) into hyperlinks.

Many of them seem to put [[::space:]] before and after to find it. But this will NOT work if the link (or whatever you are looking for) starts at the **very beginning** of the string; or the **very end** of the string.

What is needed is to look for the (^|[[:space:]]) at the beginning; and the ([[:space:]]|$) at the end.

For example here are a few types of URLs (http, https, and ftp) that are converted...

$content = ereg_replace("(^|[[:space:]])(http://[^[:space:]]{1,})([[:space:]]|$)", "\\1<a href=\"\\2\">\\2</a>\\3", $content);

$content = ereg_replace("(^|[[:space:]])(https://[^[:space:]]{1,})([[:space:]]|$)", "\\1<a href=\"\\2\">\\2</a>\\3", $content);

$content = ereg_replace("(^|[[:space:]])(ftp://[^[:space:]]{1,})([[:space:]]|$)", "\\1<a href=\"\\2\">\\2</a>\\3", $content);

And, since I didn't notice it mentioned above,... you can create smileys (for a bulletin board or whatever) with...

$content = ereg_replace('(^|[[:space:]]):-\)([[:space:]]|$)', "\\1<img src=\"image/smiley-smile.gif\">\\2", $content);

$content = ereg_replace('(^|[[:space:]]):-\(([[:space:]]|$)', "\\1<img src=\"image/smiley-frown.gif\">\\2", $content);

(For converting :-) and :-( .. You'll have to set the image sources -- the `src' attribute in the `img' tag -- to whatever you smiley image files are.)

Of course you can use this technique for whatever you want. (Not just hyperlinks and smileys.) (For example, like censoring out swearing, for a kid-safe site,... or whatever). Just use...

(^|[[:space:]])

... for the beginning. And...

([[:space:]]|$)

...for the end

-----

Charles Iliya Krempeaux


ckrempea@sfu.ca
03-Jan-2001 05:48

I just want to make a note to what I said above.

NOTE, that above I am using ([[:space:]]|$) in a single quote style string. For example...

'([[:space:]]|$)'

NOT a double quote string. You should escape out the dollar sign, $, if a double quote string. (Or else PHP will try to do a variable replacement.)

itd, itd, sam pogledaj na tim stranama...

Jel' dosta primera? &:)

E odoh ja sad napokon kucici mojoj....




22.10.2001. u 22:17 

LaMiniX

Član broj: 593
Poruke: 64
*.cg.yu

ICQ: 125470716


Profil

icon Re: AutoDetect22.10.2001. u 22:22
Ja tebi reci

SVAKA CAST :)

Hvala
Pozdrav
Sve bi bilo dobro da je pera odmah otisao na POLICIJU
22.10.2001. u 22:22 

Zoran Rašković
Serbia

Član broj: 95
Poruke: 1358
*.bct.bellsouth.net



Profil

icon Re: AutoDetect23.10.2001. u 00:15
pa regular expresiions su zakon bre!
Did you know that one of the best weight loss pills is Proactol? Well, in my experience it is certainly one of the top diet pills on the market.
23.10.2001. u 00:15 

dukenukem
Nemanja Nikolic
Beograd

Član broj: 970
Poruke: 99
*.173.EUnet.yu

ICQ: 35310908


Profil

icon Re: AutoDetect23.10.2001. u 01:24
jeste regexp. rulez
a narocito sto ih mysql podrzava
= come get some =
23.10.2001. u 01:24 

[es] :: PHP :: AutoDetect

[ Pregleda: 2193 | Odgovora: 10 ]

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.