>CF5/IIS5 > >I have a CFML tag constructed to produce as little white space as >possible -
another way is to use this custom tag: StripWhiteSpace.cfm <!--- ===================================================================== ---> <CFSETTING ENABLECFOUTPUTONLY="YES"><!--- Suspend whitespace output ---> <CFPARAM NAME="Attributes.StrengthMode" DEFAULT="Maximum"> <!--- Make sure a closing tag exists in calling template ---> <CFIF NOT ThisTag.HasEndTag> <CFABORT SHOWERROR="You need to supply a closing <CF_FileWriteText> tag."> </CFIF> <!--- When the closing tag is encountered... ---> <CFIF ThisTag.ExecutionMode is "End"> <!--- Replace multiple whitespace characters with a single space ---> <CFSWITCH EXPRESSION="#Attributes.StrengthMode#"> <CFCASE VALUE="Maximum"> <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "[[:space:]]{2,}", " ", "ALL")> </CFCASE> <CFCASE VALUE="Literate"> <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "([#Chr(13)##Chr(10)#][^[:graph:]]*[#Chr(13)##Chr(10)#])", "#Chr(13)##Chr(10)#", "ALL")> <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "[ #Chr(9)#]{2,}", "", "ALL")> </CFCASE> <CFCASE VALUE="Medium"> <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "([#Chr(13)##Chr(10)#][^[:graph:]]*[#Chr(13)##Chr(10)#])", "#Chr(13)##Chr(10)#", "ALL")> <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "[ #Chr(9)#]{2,}", " ", "ALL")> </CFCASE> <CFCASE VALUE="Light"> <CFSET ThisTag.GeneratedContent = REReplace(ThisTag.GeneratedContent, "([#Chr(13)##Chr(10)#][^[:graph:]]*[#Chr(13)##Chr(10)#])", "#Chr(13)##Chr(10)#", "ALL")> </CFCASE> <CFCASE VALUE="Off"> </CFCASE> <CFDEFAULTCASE> <CFABORT SHOWERROR="Error in CF_StripWhitespace tag. Invalid MODE attribute."> </CFDEFAULTCASE> </CFSWITCH> </CFIF> <CFSETTING ENABLECFOUTPUTONLY="NO"><!--- Re-enable whitespace output ---> <!--- ===================================================================== ---> I'm not sure who originally wrote it, but it works well. If you place it in the same directory as the calling template you can call it like this: <CF_StripWhitespace StrengthMode="maximum"> <!--- your code goes here ---> </CF_StripWhitespace> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199706 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54