Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Online Source Editor 1

Status
Not open for further replies.

wantstolearncfm

IS-IT--Management
Jun 29, 2004
160
GB
Hi,
Is their anyway i can make an online source editor in coldfusion possibly using CFFILE.
I need to be able to get hold of the page information then change some of it then write it back (mainly used for debugging errors instead of opening dreamweaver up or out and about)
So is it possible can i read a cfml document then output it edit and write it back?


CF Reference
The links of my knowledge
 
yes.
to get the code use cffile action = read
output the variable into a textarea, edit the code
use cffile action = delete to remove the old file,
use cffile action = write to save the changes

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
what are the best ways to implement failsafes into that then.
Could i copy the old file before deleting then if it works delete the copy, or if it fails rename the copy to the origional file name?
Im guessing cffile has downfalls like cfmail does, so what is the best way to secure the file!

CF Reference
The links of my knowledge
 
yeah you could rename it to include the date and time so it never deletes and you have all the backups

use cffile action = read to get the file

use cffile action = rename to rename it rename the file something like oldfilename & dateformat(now(), "mm/dd/yyyy") & timeformat(now(), "hh:mm:ss").ext

use cffile action = write to make the new file.

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top