Solved

How to make whitespace suppression work

Posted on 2004-10-26
299 Views
Last Modified: 2013-12-24
I have read the threads on white space suppression, but they do not explain
what the cfprocessingdirective tag does.

I am using the the <cfprocessingdirective> tag as follows:

<cfprocessingdirective suppresswhitespace="yes">
... all my html and CF code within the html <body> tags ...
</cfprocessingdirective>

There are no <cfinclude> tags within the cfprocessingdirective tags.

In CF admin, I have checked "Enable white space management" and I restarted CF after setting it on.

When viewing source, I can see the total white space and count the characters by pasting it into MS Word. After adding in the tags, there is not a single white space character removed from the count according to the Word character count.

What whitespace does this tags suppress and does it work independent of the CF admin setting?
0
Question by:451ls
    5 Comments
     
    LVL 22

    Expert Comment

    by:pinaldave
    0
     
    LVL 22

    Expert Comment

    by:pinaldave
    Hi 451ls,
    Summery of the previous link:

    1) CF server produces the white space while computing/evaluating the CF tags in html, and produces white spaces instead of the coldfusion tag for browser.
    As browser does ignores white spaces it will be not displayed to you but when you see the srouce those white spaces are there instead of the coldfusion code you have in the code.

    This white spaces can be removed using this tag.

    2) If you have manually put the white spaces then It will not remove those white spaces there. They will be there.
    This will only remove other white spaces.

    More info is in the link above... If I will type here will be repeating them.

    Regards,
    ---Pinal
    0
     
    LVL 22

    Expert Comment

    by:pinaldave
    Hi 451ls,
    >>> What whitespace does this tags suppress and does it work independent of the CF admin setting?
    No. They work together and as per your description you have done things correct and it should work. I am thinking.

    Regards,
    ---Pinal
    0
     
    LVL 8

    Accepted Solution

    by:
    Quite frankly, after over 5 years with CF I have not seen any of there white-space removal solutions work. Here are a couple pointers based on my experience regarding white space:

    A) It doesn't matter, don't waste time on it

    B) Sometimes it's a good thing when people try to look at the source of your page and all they see is blank ;-)

    C) Instead of trying to remove whitespace, don't create it! use <cfsetting enablecfoutputonly="yes"> before sections of your code that don't have inline HTML. Don't forget to turn it off before inline HTML: <cfsetting enablecfoutputonly="no">. I have several of those statements all over my code.

    D) Use NewAtlanta's BlueDragon instead, there white-space removal works

    E) Write your own custom tag to do that - If that's really what you want, I'll dig an old one up and post it here, let me know. Note that this approach may add significant processing time.
    0
     
    LVL 35

    Assisted Solution

    by:mrichmon
    In general if you don't have tons of whitespace you won't notice a difference.

    The times you will notice it is when your page is significant whitespace - such as a page I saw this week that was 1.5MB in file size and that was all whitespace except for about 1K of text.

    In that case it was recommended to the developer that he turn on the whitespace removal and it worked in that case to reduce the  page size.

    Otherwise if you are not in an extremem case I would go with either A or C of sigmacon's solutions/suggestions.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…
    Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now