Answered
Failure with cfsetting and cfprocessingdirective?
I have the following code buried deeply in our application.
I've tried to reproduce a simpler example without success. This
example clearly fails. What can I do to get the cfsetting and
cfprocessingdirective tags to work correctly?
The code:
<cfsavecontent variable='AlsVar'><cfprocessingdirective suppresswhitespace='yes'>before<CFSETTING ENABLECFOUTPUTONLY="yes">
<cfloop index="i" from="1" to="6" step="1">
<cfif i mod 2>
#i# is Als odd<br>
<cfelse>
#i# is Als even<br>
</cfif>
</cfloop>
<CFSETTING ENABLECFOUTPUTONLY="no">after</cfprocessingdirective>
</cfsavecontent>
<cfmail from="support@uniformmarket.com" to="al@uniformmarket.com" subject="ProcessTag:#strElementName#">#AlsVar#</cfmail>
The content of the email that I get is:
before
#i# is Als odd<br>
#i# is Als even<br>
#i# is Als odd<br>
#i# is Als even<br>
#i# is Als odd<br>
#i# is Als even<br>
after
Which shows that both tags are being ignored: There is output outside the cfoutput tag AND the irregular spacing shows that whitespace is not being suppressed.
As stated, when I try simpler examples, it works and the documentation says that a "yes" in either tag overrides any number of previous "no"s!
The code:
<cfsavecontent variable='AlsVar'><cfprocessingdirective suppresswhitespace='yes'>before<CFSETTING ENABLECFOUTPUTONLY="yes">
<cfloop index="i" from="1" to="6" step="1">
<cfif i mod 2>
#i# is Als odd<br>
<cfelse>
#i# is Als even<br>
</cfif>
</cfloop>
<CFSETTING ENABLECFOUTPUTONLY="no">after</cfprocessingdirective>
</cfsavecontent>
<cfmail from="support@uniformmarket.com" to="al@uniformmarket.com" subject="ProcessTag:#strElementName#">#AlsVar#</cfmail>
The content of the email that I get is:
before
#i# is Als odd<br>
#i# is Als even<br>
#i# is Als odd<br>
#i# is Als even<br>
#i# is Als odd<br>
#i# is Als even<br>
after
Which shows that both tags are being ignored: There is output outside the cfoutput tag AND the irregular spacing shows that whitespace is not being suppressed.
As stated, when I try simpler examples, it works and the documentation says that a "yes" in either tag overrides any number of previous "no"s!
