Okay…that definitely helped our site get rid of all that whitespace. Thanks for the help guys!

 

But here’s a new challenge for us.I was wondering if you guys could help us get something going at the top of all our pages. We need to put a <DOC> tag at the top of all of our pages eventually…but there are soooo many pages. Is there a way to globally apply that <DOC> tag to all of our pages from the CF admin? I know that HTML and CF are embedded to one another, so is there some kind of script / setting that we can make / change to make a <DOC> tag appear on all of our pages? Any help would be greatly appreciated. Thanks again guys for the help earlier.

 

It’s almost time for me to cf_signout from work hahaaaa…that was lame I know. Happy Friday everyone.

 


From: Robert Reil [mailto:[EMAIL PROTECTED]
Sent: Friday, August 11, 2006 5:27 PM
To: discussion@acfug.org
Subject: RE: [ACFUG Discuss] White Space In Source Code

 

WOW guys! This is awesome.

 

I could have googled it but in the past I have found that my selection of keywords if poor as I don’t yet know the language to search in.

So its just easier with my insane schedule to just ASK. I was always taught that there is no such thing as a stupid question except the one not asked...

So I asked.

 

This is all exciting news as now we have efficient info to study to decide the best solution.

 

Charlie, Dean, I know Im a pain on here sometimes but I am really trying to find my way. (or maybe Im just “trying” your patience.)

 

Either way THANKS TO ALL!

You guys (and gals) ROCK!

 

Robert P. Reil

Managing Director,

Motorcyclecarbs.com, Inc.

4292 Country Garden Walk NW

Kennesaw, Ga. 30152

Office 770-974-8851

Fax 770-974-8852

www.motorcyclecarbs.com


From: Charlie Arehart [mailto:[EMAIL PROTECTED]
Sent: Friday, August 11, 2006 4:05 PM
To: discussion@acfug.org
Subject: RE: [ACFUG Discuss] White Space In Source Code

 

Robert, there are many solutions, 3 specific tags, 2 tags with related output control, one admin console setting, a new feature in CFMX 7 that might be helpful, and a couple of approaches not related to CFML. Pardon the few paragraphs to explain it all, but each has difference nuances and indeed offers varying levels of suppression and has slightly varying purpose (which reflect the evolution of CFML over time).

 

First, there are 3 tags:

 

<cfprocessingdirective suppresswhitespace="Yes">

 

    ... do whatever


</cfprocessingdirective>

 

It's described as controlling "whether to suppress white space characters within the cfprocessingdirective block that are generated by CFML tags and often do not affect HTML appearance. Does not affect any white space in HTML code.". That's its intent, anyway. I think people have had varying experience, but I could be wrong.

 

Note that with that tag you MUST offer a closing tag--and it has to be in one template, can't be split with one in the application.cfm, and the closing in the onrequestend.cfm.  :-)

 

Still another tag is <CFSILENT></CFSILENT>. It's described as, "Suppresses output produced by CFML within a tag’s scope. ". Again, this is a paired tag and both must be in a single template (can't be split up).

 

An older form is:

 

<cfsetting enablecfoutputonly="Yes">

 

which doesn't require a closing tag. With it, then the ONLY output generated from the CFML page (including HTML tags and static text) will be that placed within a CFOUTPUT statement. Again, even to write out an html tag and/or static text, you'd need to wrap it (or a big block of it) in a CFOUTPUT. This often confuses people, either because they forget it's on and wonder, "where's my text"? Or they turn it on intentionally and forget to wrap static text in it and wonder, "why isn't this showing up?"

 

Note that if you want to turn it back on (or off, depending on how you look at it), you use </cfsetting enablecfoutputonly="no">. And note also that this CAN indeed be split over multiple files within a request.

 

Another source of confusion with these approaches is the question of whether they impact included files and custom tags. There are differences between them in this regard, I'm pretty sure, and may be differences in behavior regarding that between CF and BD, as well as within different versions of each. Again, this stuff has been evolving over time.

 

Still another way to control output, in CFCs (CFCOMPONENT) and CFC methods and UDFs (using CFFUNCTION) is their available OUTPUT attribute. OUTPUT="no/false" can also be used to prevent any output being generated from the method, at all (again, even static text). OUTPUT="yes/true" may not be obvious. It indicates that the body is to act like it's all inside a CFOUTPUT, so you can drop in references to variables for output and they are evaluated, again, just as if within a CFOUTPUT tag. If you specify no OUTPUT attribute at all, then things work like any normal CFML page.

 

Finally, there is also an Admin console setting to suppress whitespace, which suppresses white space globally (all apps). Since you can't too easily use CFSILENT and the CFPROCESSINGDIRECTIVE variant in the application.cfm, it's another way folks try to achieve suppression. Again, there are nuances, that are worth exploring before you enable it, and I'll note also differences between CF and BD in this regard.

 

Oh, a couple last ideas: if you want to take CFML out of the picture, and just feel that CF pages in general generate too much white space, you could also consider a Servlet Filter. They can process page output after the request and could be used to remove excessive whitespace. It's not trivial to do correctly, but there are ones out there (from the Java world). I wrote about them in a Feb 2003 CFDJ article, "Fun with Filters", at http://cfdj.sys-con.com/read/41574.htm.

 

(Actually, that reminds me that in CFMX 7, you could also do something like that (manually remove excessive whitespace) in the new application.cfc onrequestend method.)

 

And last but not least, as John talked about at the ACFUG meeting, you could also ask the web server to do gzip compression of all (or some) pages. Note that this does not REMOVE the whitespace, but it compresses the page so that during transfer from server to client the penalty of it is lessened. It's worth noting that the whitespace will still remain in the browser, and while browsers generally ignore it, it still could impact the speed with which the browser page loads (and possibly other behavior, since again the whitespace is indeed still there.)

 

Hope that helps.

 

 

/charlie

http://www.carehart.org/blog/

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Reil
Sent: Friday, August 11, 2006 3:18 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] White Space In Source Code

Is there a way to have CF output a page with no whitespace in the source code?

 

Robert P. Reil

Managing Director,

Motorcyclecarbs.com, Inc.

4292 Country Garden Walk NW

Kennesaw, Ga. 30152

Office 770-974-8851

Fax 770-974-8852

www.motorcyclecarbs.com


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink
-------------------------------------------------------------


-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink
-------------------------------------------------------------

Reply via email to