Allowing specific HTML tags to be displayed
All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Allowing specific HTML tags to be displayed
Are you running CF5 or CFMX? - Original Message - From: Russ [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 8:16 AM Subject: Allowing specific HTML tags to be displayed All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
CFMX -Original Message- From: Matthew Walker [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 1:20 PM To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed Are you running CF5 or CFMX? - Original Message - From: Russ [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 8:16 AM Subject: Allowing specific HTML tags to be displayed All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Allowing specific HTML tags to be displayed
http://www.cflib.org/udf.cfm?ID=774 This should get you there. Jerry Johnson [EMAIL PROTECTED] 02/24/03 02:16PM All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Allowing specific HTML tags to be displayed
Hey Russ -- I already know what Matt's going to recommend ant that's using cfimport with an empty prefix value which will allow you to specify a directory of CF modules to replace the html tags. It's not a bad solution, however, the problem you're going to have is that you need 1 tag for each html element someone might type into the form, so ... to avoid that kind of work-creep, you might want to check out the StripTags() function that can be found both in the open-source API in my sig and on www.cflib.org. cfset thedata = striptags(allow,a,b,i,img,thedata) This syntax will remove any xml-style tag that's not a link (or anchor), bold, italic or html image tag from the string. Note that it doesn't currently remove anything but the tags themselves, so given the string hello blinkworld/blink it would return hello world, not hello . You'll probably want to do this _before_ the data goes into the db if possible because it's a reasonably large function with a lot of string manipulation. hth s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 Are you running CF5 or CFMX? - Original Message - From: Russ [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 8:16 AM Subject: Allowing specific HTML tags to be displayed All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~~ ~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index. cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/uns ubscribe.cfm?user=633.558.4 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
I'm looking in to this and realize that I've mis-described what I'm trying to do. I don't want the tags to be displayed, instead, I want them to be actually WORK. So, if someone does a href=http://www.blinktag.orgblinktag.org/a then it shows up in the output the link blinktag.org that will work. From the look of the examples in that tag, it doesn't seem that it'll do that, but I'll continue plugging at it. Thanks for the suggestion. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 1:24 PM To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed http://www.cflib.org/udf.cfm?ID=774 This should get you there. Jerry Johnson [EMAIL PROTECTED] 02/24/03 02:16PM All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
Was not! OK, maybe. Actually what I was going to suggest was replacing the on the html tags you want with a control character like chr(27) then stripping all the tags, then swapping the escaped tags back in. This was pre-first cup of morning coffee however. Isaac's udf looks nice. -Original Message- From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] Sent: Tuesday, 25 February 2003 9:43 a.m. To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed Hey Russ -- I already know what Matt's going to recommend ant that's using cfimport with an empty prefix value which will allow you to specify a directory of CF modules to replace the html tags. It's not a bad solution, however, the problem you're going to have is that you need 1 tag for each html element someone might type into the form, so ... to avoid that kind of work-creep, you might want to check out the StripTags() function that can be found both in the open-source API in my sig and on www.cflib.org. cfset thedata = striptags(allow,a,b,i,img,thedata) This syntax will remove any xml-style tag that's not a link (or anchor), bold, italic or html image tag from the string. Note that it doesn't currently remove anything but the tags themselves, so given the string hello blinkworld/blink it would return hello world, not hello . You'll probably want to do this _before_ the data goes into the db if possible because it's a reasonably large function with a lot of string manipulation. hth s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 Are you running CF5 or CFMX? - Original Message - From: Russ [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 8:16 AM Subject: Allowing specific HTML tags to be displayed All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~~ ~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index. cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/uns ubscribe.cfm?user=633.558.4 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
Is it a fairly low volume site? I have often written the code out to a temp file, and then used cfinclude to pull it in. This is mainly used for cf code stored in a db that I want to have executed. But I still don't quite get what you are trying to do. It sounds like you have HTML code in a db field. You want to output that HTML to the screen, and have it work like HTML. As far as I know (meaning I do it all the time in cf5), you just need to cfoutput the HTML code to the screen, and it will render. cfoutput#HTMLCode#/cfoutput What part are you getting stuck on? Jerry Johnson [EMAIL PROTECTED] 02/24/03 03:54PM I'm looking in to this and realize that I've mis-described what I'm trying to do. I don't want the tags to be displayed, instead, I want them to be actually WORK. So, if someone does a href=http://www.blinktag.orgblinktag.org/a then it shows up in the output the link blinktag.org that will work. From the look of the examples in that tag, it doesn't seem that it'll do that, but I'll continue plugging at it. Thanks for the suggestion. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 1:24 PM To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed http://www.cflib.org/udf.cfm?ID=774 This should get you there. Jerry Johnson [EMAIL PROTECTED] 02/24/03 02:16PM All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
I'm having difficulty ONLY allowing the following characters: b/bi/ia href=etc/aimg src=etc Right now, I have nothing allowed, but I'd like to allow linking and images, at the very least and the others are a bonus. So, I don't want to allow things like td that isn't closed--because it can break the display. No one wants that, you know? As far as volume, the site seems to be growing pretty quickly, so I'd say that it'll be a medium volume site. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 3:08 PM To: CF-Talk Subject: RE: Allowing specific HTML tags to be displayed Is it a fairly low volume site? I have often written the code out to a temp file, and then used cfinclude to pull it in. This is mainly used for cf code stored in a db that I want to have executed. But I still don't quite get what you are trying to do. It sounds like you have HTML code in a db field. You want to output that HTML to the screen, and have it work like HTML. As far as I know (meaning I do it all the time in cf5), you just need to cfoutput the HTML code to the screen, and it will render. cfoutput#HTMLCode#/cfoutput What part are you getting stuck on? Jerry Johnson [EMAIL PROTECTED] 02/24/03 03:54PM I'm looking in to this and realize that I've mis-described what I'm trying to do. I don't want the tags to be displayed, instead, I want them to be actually WORK. So, if someone does a href=http://www.blinktag.orgblinktag.org/a then it shows up in the output the link blinktag.org that will work. From the look of the examples in that tag, it doesn't seem that it'll do that, but I'll continue plugging at it. Thanks for the suggestion. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 1:24 PM To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed http://www.cflib.org/udf.cfm?ID=774 This should get you there. Jerry Johnson [EMAIL PROTECTED] 02/24/03 02:16PM All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
Wow. First of all, I never received my own post nor Isaacs. Anyway... Matt wrote: Was not! OK, maybe. Actually what I was going to suggest was replacing the on the html tags you want with a control character like chr(27) then stripping all the tags, then swapping the escaped tags back in. This was pre-first cup of morning coffee however. Isaac's udf looks nice. Isaac wrote: a bunch of stuff and... work-creep, you might want to check out the StripTags() function that can be found both in the open-source API in my sig and on www.cflib.org. cfset thedata = striptags(allow,a,b,i,img,thedata) This syntax will remove any xml-style tag that's not a link (or anchor), bold, italic or html image tag from the string. Note that it doesn't currently remove anything but the tags themselves, so given the string hello blinkworld/blink it would return hello world, not hello . You'll probably want to do this _before_ the data goes into the db if possible because it's a reasonably large function with a lot of string manipulation. Ahh. I'm not thinking it through the right way. So, when the form is submitted, strip out the tags I don't want, leave in the ones I do, then push it to the db. Then, upon viewing, have it normally display the data since all the bad tags will have been stripped out. Got it now. Thanks everyone! Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
Since the volume will be more than a few, I'd make sure you do any data manipulation ON THE WAY IN. It will cost too much to do it on the fly while displaying. For now, we will get it working this way. But to recap. 1. pull data from db you obviously know how to do this 2. remove any tags not in the following list: b/bi/ia href=etc/aimg src=etc here, use the function from Isaac: cfset thedata = striptags(allow,a,b,i,img,thedata) 3. display the resulting data as HTML cfoutput#theData#/cfoutput That should be all there is to it. Jerry Johnson [EMAIL PROTECTED] 02/24/03 04:20PM I'm having difficulty ONLY allowing the following characters: b/bi/ia href=etc/aimg src=etc Right now, I have nothing allowed, but I'd like to allow linking and images, at the very least and the others are a bonus. So, I don't want to allow things like td that isn't closed--because it can break the display. No one wants that, you know? As far as volume, the site seems to be growing pretty quickly, so I'd say that it'll be a medium volume site. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 3:08 PM To: CF-Talk Subject: RE: Allowing specific HTML tags to be displayed Is it a fairly low volume site? I have often written the code out to a temp file, and then used cfinclude to pull it in. This is mainly used for cf code stored in a db that I want to have executed. But I still don't quite get what you are trying to do. It sounds like you have HTML code in a db field. You want to output that HTML to the screen, and have it work like HTML. As far as I know (meaning I do it all the time in cf5), you just need to cfoutput the HTML code to the screen, and it will render. cfoutput#HTMLCode#/cfoutput What part are you getting stuck on? Jerry Johnson [EMAIL PROTECTED] 02/24/03 03:54PM I'm looking in to this and realize that I've mis-described what I'm trying to do. I don't want the tags to be displayed, instead, I want them to be actually WORK. So, if someone does a href=http://www.blinktag.orgblinktag.org/a then it shows up in the output the link blinktag.org that will work. From the look of the examples in that tag, it doesn't seem that it'll do that, but I'll continue plugging at it. Thanks for the suggestion. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 1:24 PM To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed http://www.cflib.org/udf.cfm?ID=774 This should get you there. Jerry Johnson [EMAIL PROTECTED] 02/24/03 02:16PM All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
You could always do things the way UBB et.al. do it. In other words, don't allow any HTML, but do allow certain codes with a different marker (UBB uses []) that you will replace with HTML on the fly. I can't imagine anyone hasn't encountered a UBB discussion forum yet, but for completeness, here's an example: This text is [b]bold[/b], this is [i]italic[/i] and this is [link url=http://www.m-w.com/]a link[/link]. Oh yeah, here's an image: [image src=//http://www.macromedia.com/uber/nav/pure_images/gn_mm_logo.gif] -Original Message- From: Russ [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 4:20 PM To: CF-Talk Subject: RE: Allowing specific HTML tags to be displayed I'm having difficulty ONLY allowing the following characters: b/bi/ia href=etc/aimg src=etc Right now, I have nothing allowed, but I'd like to allow linking and images, at the very least and the others are a bonus. So, I don't want to allow things like td that isn't closed--because it can break the display. No one wants that, you know? As far as volume, the site seems to be growing pretty quickly, so I'd say that it'll be a medium volume site. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 3:08 PM To: CF-Talk Subject: RE: Allowing specific HTML tags to be displayed Is it a fairly low volume site? I have often written the code out to a temp file, and then used cfinclude to pull it in. This is mainly used for cf code stored in a db that I want to have executed. But I still don't quite get what you are trying to do. It sounds like you have HTML code in a db field. You want to output that HTML to the screen, and have it work like HTML. As far as I know (meaning I do it all the time in cf5), you just need to cfoutput the HTML code to the screen, and it will render. cfoutput#HTMLCode#/cfoutput What part are you getting stuck on? Jerry Johnson [EMAIL PROTECTED] 02/24/03 03:54PM I'm looking in to this and realize that I've mis-described what I'm trying to do. I don't want the tags to be displayed, instead, I want them to be actually WORK. So, if someone does a href=http://www.blinktag.orgblinktag.org/a then it shows up in the output the link blinktag.org that will work. From the look of the examples in that tag, it doesn't seem that it'll do that, but I'll continue plugging at it. Thanks for the suggestion. Russ -Original Message- From: Jerry Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, February 24, 2003 1:24 PM To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed http://www.cflib.org/udf.cfm?ID=774 This should get you there. Jerry Johnson [EMAIL PROTECTED] 02/24/03 02:16PM All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
2. remove any tags not in the following list: b/bi/ia href=etc/aimg src=etc here, use the function from Isaac: cfset thedata = striptags(allow,a,b,i,img,thedata) I love helping people. :) Incidentally, as Russ was mentioning, yes, you shouldn't do this on the fly with more than a few visitors. Particularly with the StripTags UDF as it's written, because the tag does a lot of extra validation (granted it's all regex, but still) for things like white space inside the and characters, for instance, if someone enters td or / td these will be stripped the same as td and /td, and all of the searching the string for a handfull of different tags and then removing that tag (or something that's not that tag) is rather labor intensive for the server, so since your inserts and updates will usually be on a ratio of somewhere between 1/10 and 1/1000+ to your page views, you really want to do all that before the insert or update and save somewhere between 9/10ths and all but a couple parts per million processing time. One sentence! Woohoo! s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Allowing specific HTML tags to be displayed
I like using the beep code (chr(7)) for this. :P Four score and beep seven beep years beep... Was not! OK, maybe. Actually what I was going to suggest was replacing the on the html tags you want with a control character like chr(27) then stripping all the tags, then swapping the escaped tags back in. This was pre-first cup of morning coffee however. Isaac's udf looks nice. -Original Message- From: S. Isaac Dealey [mailto:[EMAIL PROTECTED] Sent: Tuesday, 25 February 2003 9:43 a.m. To: CF-Talk Subject: Re: Allowing specific HTML tags to be displayed Hey Russ -- I already know what Matt's going to recommend ant that's using cfimport with an empty prefix value which will allow you to specify a directory of CF modules to replace the html tags. It's not a bad solution, however, the problem you're going to have is that you need 1 tag for each html element someone might type into the form, so ... to avoid that kind of work-creep, you might want to check out the StripTags() function that can be found both in the open-source API in my sig and on www.cflib.org. cfset thedata = striptags(allow,a,b,i,img,thedata) This syntax will remove any xml-style tag that's not a link (or anchor), bold, italic or html image tag from the string. Note that it doesn't currently remove anything but the tags themselves, so given the string hello blinkworld/blink it would return hello world, not hello . You'll probably want to do this _before_ the data goes into the db if possible because it's a reasonably large function with a lot of string manipulation. hth s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 Are you running CF5 or CFMX? - Original Message - From: Russ [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 8:16 AM Subject: Allowing specific HTML tags to be displayed All-- I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Thanks, Russ ~~~ ~~~ ~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid =4 Subscription: http://www.houseoffusion.com/cf_lists/index. cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/uns ubscribe.cfm?user=633.558.4 ~~ ~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index. cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/uns ubscribe.cfm?user=633.558.4 s. isaac dealey954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Allowing specific HTML tags to be displayed
- Original Message - From: Russ [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, February 24, 2003 12:16 PM Subject: Allowing specific HTML tags to be displayed I've still not had any luck trying to get Replace or ReReplace to allow a set of specific codes when displaying information from a database. I'm hoping to allow for only specific sets: Italics, Bold, A HREF and IMG SRC and I'm baffled as to how to get this to work. It's a bit of a repost, but I'm really striking out. Here is how I would approach it: 1. Use the ReplaceList() function to replace all permitted tags and matching end-tags with tokens unique to each tag. The tokens will have to be fairly unique - using control characters would be a good idea to replace the brackets. cfset bmarker = Chr(2) cfset emarker = Chr(3) cfset mystring = ReplaceList(mystring, b,i,u,/b,/i,/u, #bmarker#b,#bmarker#i,#bmarker#u,/b#emarker#,/i#emarker#,/u#emarker#) 2. Invalidate all of the remaining HTML by either stripping out the entire HTML tags, or by turning the and into special lt; and gt; characters. You can do the latter with: cfset mystring = ReplaceList(mystring, ,, lt;,gt;) 3. Replace the tokens with their original tags (i.e. reversing step 1). cfset mystring = ReplaceList(mystring, #bmarker#b,#bmarker#i,#bmarker#u,/b#emarker#,/i#emarker#,/u#emarker#, b,i,u,/b,/i,/u) Jim ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4