G'day
Gordon Bennett. This one did my head in (trying to replicate it, and
work out WTF was going on, I mean).
Consider this code:
<!--- caller.cfm --->
<cf_looper from="1" to="10" index="iCount">
<cfoutput>#iCount#</cfoutput><br />
</cf_looper>
<!--- looper.cfm --->
<cfprocessingdirective suppresswhitespace="true">
<cfparam name="counter" default="#attributes.from#">
<cfif thisTag.executionMode is "start">
<cfset caller[attributes.index] = counter>
<cfelse>
<cfset counter = counter + 1>
<cfset caller[attributes.index] = counter>
<cfif counter lte attributes.to>
<cfexit method="loop">
</cfif>
</cfif>
</cfprocessingdirective>
Output on CF:
1
2
3
4
5
6
7
8
9
10
Output on OBD:
1
Now. Remove the <cfprocessingdirective> tags.
Output on OBD:
1
2
3
4
5
6
7
8
9
10
Needless to say, when trying to troubleshoot this (the real code is
somewhat more complicated than this ;-), it's not like it was the
first thing to occur to me "oh, I bet it's the <cfprocessingdirective>
tag!". No. That came after about 3h. I need a drink.
>From what I can see, it's only the iterating tags that have this
problem... so a clash between <cfprocessingdirective> and <cfexit
method="loop">? Dunno.
I'll raise this as a bug. It's a bit of an edge case, and I can
easily refactor my code to get it working again, but with CF's
nightmare treatment of whitespace in custom tags, I do really like to
have the belt, braces, and another belt approach to my code
(<cfprocessingdirective>, <cfsilent> & <cfsetting
enablecfoutputonly="true">). I've not actually checked to see how OBD
handles whitespace "generosity" in this regard actually. But this
code is mostly targetted at CF, so I need to deal with it. But I'm
sure I can do with only one belt and braces in this case ;-)
Cheers.
--
Adam
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
official manual: http://www.openbluedragon.org/manual/
Ready2Run CFML http://www.openbluedragon.org/openbdjam/
mailing list - http://groups.google.com/group/openbd?hl=en