Dave recommended using a single variable:

: <cfset mystr = "">
: <cfset CrLf = Chr(13) & Chr(10)>
: <cfoutput query="hello">
:   <cfset mystr = mystr & fname & "," & lname & CrLf>
: </cfoutput>
: <cffile action="write" output="#mystr#" ...>

Actually, you could take this one step further and make it pretty
transparent:

<CF_SaveFileContent File="filename.txt">
<CFOUTPUT query="hello">#fname#,#lname#
</CFOUTPUT>
</CF_SaveContent>

Then, your CF_SaveFileContent tag is really simple:

<CFIF ThisTag.ExecutionMode IS "End">
  <CFFILE ACTION="WRITE" FILE="#Attributes.File#"
OUTPUT="#ThisTag.GeneratedContent#">
  <CFSET ThisTag.GeneratedContent="">
</CFIF>

You can do pretty much *anything* you want in that first set of tags.
Output, formatting, logic, whatever.  If you don't want to write your own
custom tag (even if it is just 4 lines), and you have CF5(?), use
CFSAVECONTENT.

-R


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to