Use the paired custom tag syntax:

<cf_savepage>
  ...generate your content...
</cf_savepage>

In savepage.cfm, put in this code:

<cfif thistag.executionmode is "end">
  <cffile action="write" input="#thistag.generatedcontent#"...>
  <cfset thistag.generatedcontent="">
</cfif>

> -----Original Message-----
> From: David Cummins [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 08, 2000 3:05 PM
> To: [EMAIL PROTECTED]
> Subject: Re: How to pipe CF code to a file?
>
>
> There are a few ways that come to mind...
>
> You could call the page with CFHTTP, and then write the returned
> contents to a
> file (moderately ugly).
>
> You could use CFSCHEDULE (I think it has a "output to file"
> option) (moderately
> ugly).
>
> Or, you could write a custom tag to grab the HTML output.
> Assuming you've had a
> quick read up about custom tags (its in the advanced Forta book),
> use the line
> below to capture the output when then tag ends execution:
> <cfset caller.somevariable=ThisTag.GeneratedContent>
>
> David Cummins
>
> Ryan wrote:
> >
> > Hello. I need to be able to execute a set of CF tags but
> > send the output to a file not to the web browser. An entire
> > HTML page, not just some data.
> >
> > So, for example, I have process.cfm, full of CF tags and includes,
> > etc, how can I execute this and pipe it to a file?
> >
> > I tried a couple of things:
> >
> > <CFFILE ACTION=write
> FILE="/home/WWW-data/siouxland/homepage/rps/output.cfm"
> > OUTPUT="<CFINCLUDE TEMPLATE='../calendar.cfm'>">
> > This just puts the literal 'CFINCLUDE...' in there.
> >
> > Also tried reading in and writing back out with CFFILE, just
> > makes a copy of the file of course. What I need is to be able
> > to 'eval' the code in the variable before writing it back out.
> > The CF evaluate tag does not work, it is really only made to
> > evaluate an expression, not a chunk of code like the perl eval
> > command.
> >
> > Thanks for any help.
> >
> > Ryan
> >
> >
> ------------------------------------------------------------------
> ------------
> > Archives: http://www.mail-archive.com/[email protected]/
> > To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to