Search This Blog

Wednesday, May 29, 2013

ColdFusion: Reduce/Suppress Whitespaces

Without implementing proper technique, by default ColdFusion generates unnecessary whitespaces on result page. This will cause the page size bigger and consequently it will take more time to load the page. To suppress the whitespaces, we can enable whitespace management in CF Admin and/or do one of the following techniques:

<cfsilent>...</cfsilent>
 Absolutely no output. Not even <cfoutput> nor <cfdump>.
 Require closing tag </cfsilent>.
 
output="false"
 One of the attributes in <cfcomponent> and <cffunction>.
 It works like <cfsilent>.
 
<cfsetting enablecfoutputonly="true">
 Only output things that are wrapped with <cfoutput>. 
 It works with <cfdump>.
 The effect goes to <cfinclude> as well.
 Matching tag, <cfsetting enablecfoutputonly="false"> is highly recommended.
 Closing tag </cfsetting> is optional and does not have any effect.
 Multiple declarations behave like a counter. 

<cfprocessingdirective suppresswhitespace="true">...</cfprocessingdirective >
 It reduces whitespaces, but it is not as effective as <cfsilent> or <cfsetting>.
 <cfoutput> is not required.
 Require closing tag </cfprocessingdirective>.

<!--- BONUS --->
<cfsetting showdebugoutput="false">
 Disable debugging mode when Debugging Settings in CF Admin is enabled.

SEE ALSO:
ColdFusion Whitespace Options

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.