Skip to main content
Inspiring
March 24, 2009
Answered

Create an entire web page using cffile

  • March 24, 2009
  • 3 replies
  • 960 views
I would like to create an entire web page using cffile..

it seems that the output attribute is where you put the content like:

output="this is a test."

Q: so how do you add the full .htm content inside .... output=""
... where there will be lots of other double quotes?

(if it involves 'escaping' characters - then I'll need some help with that.)

Also : is it possible that the content could be some data combined with an cfinclude - i get errors when i try this...

    This topic has been closed for replies.
    Correct answer JR__Bob__Dobbs-qSBHQ2
    You might find the CFSAVECONTENT tag useful.
    http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_r-s_10.html#1844410

    3 replies

    Participating Frequently
    March 24, 2009
    <cfsavecontent variable="pageContent">
    <html>
    <head>
    ...
    </head>
    <body>
    ...
    </body>
    </html>
    </cfsavecontent>

    <cffile action="write" output="#pageContent#" ...>

    Edit: JR beat me to it.
    JR__Bob__Dobbs-qSBHQ2Correct answer
    Inspiring
    March 24, 2009
    revdaveAuthor
    Inspiring
    March 25, 2009
    JR "Bob" Dobbs & Kronin555

    cfsavecontent worked perfectly as you described it!!!

    Now, using cfsavecontent along with cffile, I can print hard copy static web pages like I want to!

    Thanks soooooo much!


    Inspiring
    March 24, 2009
    Out of curiosity, why would you want to do this? It seems as if creating a page via industry standards would be much simpler.
    revdaveAuthor
    Inspiring
    March 24, 2009
    Hi rmorgan,

    I have stuff stored in a data base and want to create real static full .htm pages from that data rather than to display in by dynamically loading cf data into 1 master page.