Thanks for the response, Colin,
Your email was helpful. But it appears that given the restrictions you
state, it's not possible in some situations to get rid of all white space.
The example I gave was a simplistic one.  I've decided to grad a chunk of
the real file I was wrestling with and pasted it below.
Notice that after the first closing /cfsilent tag, the next place I can
place an opening cfsilent is about 7 lines down.  Considering it's in a
loop, it gets repeated each iteration in the loop.  It also calls for many
cfsilent groupings to cover the inbetween places where cfsilent can't go.

I think your alternative solution is probably the better way to go in this
situation, but I still think that cfsilent is limited and tricky to use.
I'll give the alternate approach some thought.  If you have other
suggestions on how to deal with code like below to get rid of all white
space, let me know.

Bruce


..
<cfset PrevUpdateType = 0>
<cfset subHeaderLine = "">
<cfset CurVID = qGetUserAgents.vid>
<cfset ProcAMIDList = "">

<!--- Loop on the qualified list of AMIDs for each user --->
</cfsilent>
<cfloop index="CurAMID" list=#stUserAMIDs[vid]#>
    <!--- Check if the type changed...time to put up a new sub-header label
if so --->
    <cfif stAMIDdocUType[CurAMID] neq PrevUpdateType>
        <cfswitch expression=#stAMIDdocUType[CurAMID]#>
            <cfcase value="1">
                <strong>New Documents:</strong><br>
                <cfsilent>
                <cfset subHeaderLine = cr & "New Information (placed on the
website since " & Dateformat(LastReportDate, 'mmm dd, yyyy') & " 12:00
am):">
                <cfset SummaryLabel = "Description: ">
                </cfsilent>
            </cfcase>
            <cfcase value="2">
                <strong>Modified Documents:</strong><br>
                <cfsilent>
                <cfset subHeaderLine = cr & "Modified Information (since " &
Dateformat(LastReportDate, 'mmm dd, yyyy') & " 12:00 am):">
                <cfset SummaryLabel = "Modifications: ">
                </cfsilent>
            </cfcase>
        </cfswitch>

        <cfsilent>
        <!--- Construct the email message body for TEXT email msg and store
it in a structure indexed by VID --->
        <cfset stUserMsgBodyDocs[CurVID] = stUserMsgBodyDocs[CurVID] & cr &
subHeaderLine & cr &
"---------------------------------------------------------------------------
-" & cr>
        <cfset PrevUpdateType = stAMIDdocUType[CurAMID]>
        </cfsilent>
    </cfif>
    <cfsilent>
..

As for my comments about the Language Ref Manual...I have been helped by it
many times but other times its descriptions are so stripped to the bone
skimpy, its of little value.  Many times I've looked up documentation and
found it almost worthless.  The CFSILENT tag is one example.  You gave me
more info that the book and it's important info.

For another example, take a look at the CreateODBCDateTime function.  It
says "Returns a date/time object in ODBC timestamp format."  Wow, I could
have figured that out from the title of the function.  But what is ODBC
timestamp format?  When should I use it?


----- Original Message -----
From: "Colin Fyfe" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, September 21, 2001 3:00 AM
Subject: RE: CFSILENT


> Hi Bruce,
>
> CFSILENT is a great tag IMO. It allows us to suppress all whitespace
> generated within our custom tags, even when a custom tag is called from
> within a CFOUTPUT block - if only Spectra (1.0) custom tags used
CFSILENT...
>
> Anyway, CFSILENT is like any other CF tag which has an opening and closing
> tag - it must be closed on the same level as it was opened. Have a look
> at your CFIFs, CFLOOPs, CFOUTPUTs, CFSWITCHs, etc. - they all close on the
> same level as they were opened or the CF engine won't interpret the code.
>
> The example you gave that doesn't work can be amended slightly such that
> it does by simply closing the CFSILENT before you enter the CFIF block. It
> can then be reopened as and when you need it to hide white space. One of
the
> techniques we use is to build all output in a variable then output it
> after the closing CFSILENT at the end of the custom tag file.
Alternatively,
> when a custom tag has no content output but returns data we use error
> handling tags like CFEXIT, CFTHROW, etc. to exit from the tag before we
> reach the closing CFSILENT.
>
> Your example could therefore be amended as follows (I'm asumming that you
> want the "Some text" bits to be displayed to the user):
>
..
>
> Alternatively, you could try this approach:
>
..
> While the latter may look a bit unusual, on processing-heavy templates
> it improves performance (straight from Macromedia Consulting).
>
> Hope this helps. BTW, is the CF Language Reference really that lame?
> I used to swear by it when I was learning ColdFusion.
>
> Colin
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to