Using CFFILE to write ColdFusion files

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Using CFFILE to write ColdFusion files

    I want to use CFFILE to write out ColdFusion files instead of just text files.
    I can't find this in the documentation anywhere.

    I can get it to create a .cfm file and write to it, as long as I don't have
    any # signs. Which of course does me no good.

    I'm wondering if there is some way to get it to not evaluate the # signs when
    I'm setting the output variable, so it will actually write them to the
    ColdFusion file.

    Here's what I have:

    <html>
    <head>
    <title>Write ColdFusion File</title>
    </head>

    <body>


    <cfset thisoutput="<cfquery datasource=MyDatasource name=GetData>Select
    PageTitle from tblContent</cfquery><cfoutput
    query=GetData>#GetData.PageTitle#</cfoutput>">

    <cffile action="write" file="C:\inetpub\wwwroot\MyTestFile.cfm"
    output="#thisoutput#">

    </body>
    </html>

    shaunna_shelton Guest

  2. Similar Questions and Discussions

    1. cffile write no longer working
      I am using cffile write on cfmx7 to create lots of html static files. Since today it is not working anymore. I tried to restart the coldfusion...
    2. How to use CFFILE to rename files
      I tired the following and got error, please help! All I need is appending all the files within FolderA with "Version1_" in front of the file name...
    3. cffile write
      Hi all, I am trying to output to a txt file using cffile write. Problem is I output a query with a header and run a subquery inside of each...
    4. cffile action=write ... does nothing
      Hi! I am trying to write to a file and nothing happend... Not even an error message! Do I have to setup someting special on the server? Here is my...
    5. CFFile won't delete files
      I have a list of articles in my knowledgebase some of which are totally web based and others are DOC or PDF files.... The admin is allowed to...
  3. #2

    Default Re: Using CFFILE to write ColdFusion files

    Just double up the pound signs:
    cfoutput query=GetData>##GetData.PageTitle##</cfoutput>">

    After you write it to a file you will have to cfinclude it.
    OldCFer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139