Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

view source

Status
Not open for further replies.

aarontra

Programmer
Oct 2, 2002
50
US
When I view that source on my Coldfusion pages there is a lot of blank lines at the top of the file.
(Windows, Coldfusion 4.5, I.E. 5.5)


I do not remember this when coding ASP pages.
Has anyone else seen this?
Can and or how do I get rid of it?

Not really that urgent, just annoying.

Thank you
Aaron
 
You are referring to the HTML pages generated by your ColdFusion templates, not the ColdFusion pages themselves. That is normal in CF4.5. ColdFusion outputs all the non-CF content as-is, including blank lines. In addition, any blank lines inside a loop (CFLOOP, CFOUTPUT) are output once for each iteration of the loop. You can reduce, but likely not eliminate, excess lines by putting <cfsetting enablecfoutputonly=&quot;yes&quot;> at the top of your page, and <cfsetting enablecfoutputonly=&quot;no&quot;> at the bottom. Then, you must put any output lines in that page inside <cfoutput> tags, even if the output is just plain text.

Sometimes you might use CFOUTPUT to loop through the records returned by a query, but you are not outputting anything. You'll get a lot of blank lines in your HTML as a result. The <CFSETTING> advice above will not prevent those blank lines because they are between CFOUTPUT tags. To eliminate the blank lines, use CFLOOP instead of CFOUTPUT to loop through the recordset.

Note that you can nest <CFSETTING ENABLECFOUTPUTONLY> tags. Be careful about this. If you have two &quot;YES&quot; tags, you must have two &quot;NO&quot; tags to cancel the effect.

<CFSETTING ENABLECFOUTPUTONLY=&quot;YES&quot;>
this code will not output
<cfoutput>this code will output</cfoutput>
<CFSETTING ENABLECFOUTPUTONLY=&quot;YES&quot;>
this code will not output
<cfoutput>this code will output</cfoutput>
<CFSETTING ENABLECFOUTPUTONLY=&quot;NO&quot;>
this code will not output
<cfoutput>this code will output</cfoutput>
<CFSETTING ENABLECFOUTPUTONLY=&quot;NO&quot;>
this code WILL output
<cfoutput>this code will output</cfoutput>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top