Re: [WebDNA] Display Live URL from a Block of Copy
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 101952
interpreted = N
texte = Hmmm, my very first thought is to [listwords] with the space char. as a d=elimiter, but it might=20end up being process-intensive if you have a lot of it going on. If you g=ot this route, it might=20be best to detect and change to live URLs then write them to the .db rath=er than detect and change=20on-the-fly upon every display.[!]-- Do this after all cleansing routines, of course (XSS, etc.) --[/!] [listwords words=3D[grep search=3D%20&replace=3D ][url][your_block_of=_text][/url][/grep]&delimiters=3D=20] [showif [word]~http://] [grep search=3D[word]&replace=3D[url]
[/url][word][url][/url]][word][/grep] [/showif] [/listwords]I grepped [url]'ed spaces in the [listwords] since multiple chars can't b=e delimiters that I know=20of and you'd need to force user to enter "http://" or detect and add your=self if not there. Also,=20you'd need to obviously [unurl] everything either when writing to .db or =displaying.This really seems overly-complicated to me, but it was my first thought, =and an incomplete on at=20that. I am sure there's a much more elegant way to tackle this, but hopef=ully it will give you an=20idea.-DanOn Sun, 08 Feb 2009 14:01:31 -0600 Eddie Z
wrote:> I thought I'd ask everyone before I dive in and try some stuff... I hav=e a> site where I allow an administrator to post content/text to a db via a> textarea. I want them to be able to post website URLs in the textarea a=nd> have the URL be a live link when it is displayed on the site. So in oth=er> words, I want to pull out URLs from a block of copy and make them live,> clickable links when they are displayed on my web page. I would assume> there's a way to do this, but I've never had to try it until now.>=20> A push in the right direction would be appreciated.> Eddie
Associated Messages, from the most recent to the oldest:
Hmmm, my very first thought is to [listwords] with the space char. as a d=elimiter, but it might=20end up being process-intensive if you have a lot of it going on. If you g=ot this route, it might=20be best to detect and change to live URLs then write them to the .db rath=er than detect and change=20on-the-fly upon every display.[!]-- Do this after all cleansing routines, of course (XSS, etc.) --[/!] [listwords words=3D[grep search=3D%20&replace=3D ][url][your_block_of=_text][/url][/grep]&delimiters=3D=20] [showif [word]~http://] [grep search=3D[word]&replace=3D[url][url]">[/url][word][url][/url]][word][/grep] [/showif] [/listwords]I grepped [url]'ed spaces in the [listwords] since multiple chars can't b=e delimiters that I know=20of and you'd need to force user to enter "http://" or detect and add your=self if not there. Also,=20you'd need to obviously [unurl] everything either when writing to .db or =displaying.This really seems overly-complicated to me, but it was my first thought, =and an incomplete on at=20that. I am sure there's a much more elegant way to tackle this, but hopef=ully it will give you an=20idea.-DanOn Sun, 08 Feb 2009 14:01:31 -0600 Eddie Z wrote:> I thought I'd ask everyone before I dive in and try some stuff... I hav=e a> site where I allow an administrator to post content/text to a db via a> textarea. I want them to be able to post website URLs in the textarea a=nd> have the URL be a live link when it is displayed on the site. So in oth=er> words, I want to pull out URLs from a block of copy and make them live,> clickable links when they are displayed on my web page. I would assume> there's a way to do this, but I've never had to try it until now.>=20> A push in the right direction would be appreciated.> Eddie
"Dan Strong"
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Q: how long for answers to the WebDNA-Talk list? (1997)
[append] and SSL (1997)
Ok here is a question? (1997)
WebCat Slowdown (2000)
Error 11 (1996)
Banner DNA (1997)
Online reference (1997)
Re:quit command on NT (1997)
Help formatting search results w/ table (1997)
Linux problems (2000)
Fuck you (1998)
Re:E-Mailer (WebCatb15acgiMac) (1997)
Limiting user access to .tmpl files (1997)
First postarg not taking in $Commands (1997)
formulas.db ?? (1998)
Permission denied? (2004)
encripted storage (1998)
[listfiles] problems (1997)
Summing fields (1997)
find with exceptions (1997)