Re: cf file write

2004-01-03 Thread Matthew Walker
Prepend? No built-in way, which is a shame. This is how I'd do it:

1) read the file to a variable. 
2) prepend the data to the variable data
3) write the variable data to a new temp file
4) delete the original file
5) rename the temp file to the name of the original file

This is inelegant and I'd think slow. It might be OK if you weren't hitting it much, but under load I'd think it would be a bad idea.

Regards,
Matthew Walker
Electric Sheep Web
http://www.electricsheep.co.nz/
- Original Message - 
From: Robert Orlini 
To: CF-Talk 
Sent: Thursday, January 01, 2004 5:50 AM
Subject: RE: cf file write

Thanks Matt.

Is there anyway to append information to the top of a file. I'm doing it to the bottom, but it would be nice if I can get a certain line on the very top.

Robert O.

-Original Message-
From: Matthew Walker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 4:56 PM
To: CF-Talk
Subject: RE: cf file write

Try this:

cfset a=cfoutput123/cfoutput

cfoutput#a#/cfoutput

View the page's HTML. You should see the cfoutput tags in there - at least I
do on 6.1.

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:54 a.m.
To: CF-Talk
Subject: Re:cf file write

Since I suggested using CFscript its my bad. If you were outside of CFSCRIPT
then you would need to escape . 

Are you sure about escaping ? Never seen that before, and when I
experimented with it I just got two of each. The only thing you need to
escape is . 

 

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:07 a.m.
To: CF-Talk
Subject: Re:cf file write

 

Yes, you can create .cfm files from CFILE=write

Here's how it world work
1) Move all CF code into a single variable. My perferance would be to use
CFscript synatx, since it will force you to use the correct syntax--

cfscript
cftext=cfoutput
cfset var=#evaluate(myvar)#
cfoutput;
// yes, you will need to double pound, double quote and double  every
time
you need a variable or a tag
/cfscript

CFfile action="" 
file=e:\_promotrials\#trialname#\trial_include.cfm 
output=#cftext#

2) test and use

 Can CFFILE be used to write and output a cf file (.cfm) not a text (.
 txt) file?
 
 How would I work this?
 
 I have this down: CFfile action="" 
 file=e:\_promotrials\#trialname#\trial_include.cfm 
 output=
 
 It crashes when I insert info from the .cfm file that includes quotes.
 
 
 Roberto O.
HWW

_



 _ 
 _
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: cf file write

2004-01-03 Thread Raymond Camden
Why would you need to write to a temp file, erase the orig, and rename the
temp? If you use cffile with th write command, it will overwrite the old
data.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: cf file write

2003-12-31 Thread Robert Orlini
Thanks Matt.

 
Is there anyway to append information to the top of a file. I'm doing it to the bottom, but it would be nice if I can get a certain line on the very top.

 
Robert O.

-Original Message-
From: Matthew Walker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 30, 2003 4:56 PM
To: CF-Talk
Subject: RE: cf file write

Try this:

cfset a=cfoutput123/cfoutput

cfoutput#a#/cfoutput

View the page's HTML. You should see the cfoutput tags in there - at least I
do on 6.1.

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:54 a.m.
To: CF-Talk
Subject: Re:cf file write

Since I suggested using CFscript its my bad. If you were outside of CFSCRIPT
then you would need to escape . 

Are you sure about escaping ? Never seen that before, and when I
experimented with it I just got two of each. The only thing you need to
escape is . 

 

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:07 a.m.
To: CF-Talk
Subject: Re:cf file write

 

Yes, you can create .cfm files from CFILE=write

Here's how it world work
1) Move all CF code into a single variable. My perferance would be to use
CFscript synatx, since it will force you to use the correct syntax--

cfscript
cftext=cfoutput
cfset var=#evaluate(myvar)#
cfoutput;
// yes, you will need to double pound, double quote and double  every
time
you need a variable or a tag
/cfscript

CFfile action="" 
file=e:\_promotrials\#trialname#\trial_include.cfm 
output=#cftext#

2) test and use

 Can CFFILE be used to write and output a cf file (.cfm) not a text (.
 txt) file?
 
 How would I work this?
 
 I have this down: CFfile action="" 
 file=e:\_promotrials\#trialname#\trial_include.cfm 
 output=
 
 It crashes when I insert info from the .cfm file that includes quotes.
 
 
 Roberto O.
HWW

_



_ 
_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: cf file write

2003-12-30 Thread Kristopher Pilles
I do it all the time... works great...

 
cfsavecontent variable=page

 
HTML HERE
/cfsavecontent

 
CFFILE ACTION="">

 
FILE=z:\domains\YOURSITE.com\wwwroot\#ltrim(statename)#\#ltrim(countyna
me)#\#ltrim(city)#.htm
 OUTPUT=#page#

Hope that helps?

	-Original Message-
	From: Robert Orlini [mailto:[EMAIL PROTECTED] 
	Sent: Tuesday, December 30, 2003 3:35 PM
	To: CF-Talk
	Subject: cf file write
	
	
	Can CFFILE be used to write and output a cf file (.cfm) not a
text (.txt) file?
	
	How would I work this?
	
	I have this down: CFfile action="">
file=e:\_promotrials\#trialname#\trial_include.cfm 
	output=
	
	It crashes when I insert info from the .cfm file that includes
quotes.
	
	Roberto O.
	HWW 

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: cf file write

2003-12-30 Thread Bryan Stevenson
hnot sure you can write a CFM file, but you may be able to write it as a TXT file and then rename it to a CFM file (just athought...haven't tested it)

Cheers

Bryan Stevenson B.Comm.
VP  Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

-
Macromedia Associate Partner
www.macromedia.com
-
Vancouver Island ColdFusion Users Group
Founder  Director
www.cfug-vancouverisland.com
- Original Message - 
From: Robert Orlini 
To: CF-Talk 
Sent: Tuesday, December 30, 2003 12:34 PM
Subject: cf file write

Can CFFILE be used to write and output a cf file (.cfm) not a text (.txt) file?

How would I work this?

I have this down: CFfile action="" file=e:\_promotrials\#trialname#\trial_include.cfm 
output=

It crashes when I insert info from the .cfm file that includes quotes.

Roberto O.
HWW
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: cf file write

2003-12-30 Thread Matthew Walker
Are you sure about escaping ? Never seen that before, and when I
experimented with it I just got two of each. The only thing you need to
escape is . 

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:07 a.m.
To: CF-Talk
Subject: Re:cf file write

Yes, you can create .cfm files from CFILE=write

Here's how it world work
1) Move all CF code into a single variable. My perferance would be to use
CFscript synatx, since it will force you to use the correct syntax--

cfscript
cftext=cfoutput
cfset var=#evaluate(myvar)#
cfoutput;
// yes, you will need to double pound, double quote and double  every time
you need a variable or a tag
/cfscript

CFfile action="" 
file=e:\_promotrials\#trialname#\trial_include.cfm 
output=#cftext#

2) test and use

 Can CFFILE be used to write and output a cf file (.cfm) not a text (.
 txt) file?
 
 How would I work this?
 
 I have this down: CFfile action="" 
 file=e:\_promotrials\#trialname#\trial_include.cfm 
 output=
 
 It crashes when I insert info from the .cfm file that includes quotes.
 
 
 Roberto O.
HWW

_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: cf file write

2003-12-30 Thread Matthew Walker
Try this:

cfset a=cfoutput123/cfoutput

cfoutput#a#/cfoutput

View the page's HTML. You should see the cfoutput tags in there - at least I
do on 6.1.

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:54 a.m.
To: CF-Talk
Subject: Re:cf file write

Since I suggested using CFscript its my bad. If you were outside of CFSCRIPT
then you would need to escape . 

Are you sure about escaping ? Never seen that before, and when I
experimented with it I just got two of each. The only thing you need to
escape is . 

 

-Original Message-
From: Jeremy Brodie [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 31 December 2003 8:07 a.m.
To: CF-Talk
Subject: Re:cf file write

 

Yes, you can create .cfm files from CFILE=write

Here's how it world work
1) Move all CF code into a single variable. My perferance would be to use
CFscript synatx, since it will force you to use the correct syntax--

cfscript
cftext=cfoutput
cfset var=#evaluate(myvar)#
cfoutput;
// yes, you will need to double pound, double quote and double  every
time
you need a variable or a tag
/cfscript

CFfile action="" 
file=e:\_promotrials\#trialname#\trial_include.cfm 
output=#cftext#

2) test and use

 Can CFFILE be used to write and output a cf file (.cfm) not a text (.
 txt) file?
 
 How would I work this?
 
 I have this down: CFfile action="" 
 file=e:\_promotrials\#trialname#\trial_include.cfm 
 output=
 
 It crashes when I insert info from the .cfm file that includes quotes.
 
 
 Roberto O.
HWW

_



_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]