Skip to main content
Known Participant
August 24, 2009
Question

ColdFusion in HTML pages

  • August 24, 2009
  • 5 replies
  • 2475 views

Hello,

Is there any way to use ColdFusion code in an HTML page?  I have a section of an HTML page where I want to put dynamic content, but I don't want to have to save the page as a .cfm file.  All I need to use is a cfinclude tag.

Thanks!

    This topic has been closed for replies.

    5 replies

    tclaremont
    Inspiring
    August 26, 2009

    Well, if you dont want people to have to change their bookmarks, you could insert an auto redirect In the HTML page) to the ColdFusion page. People's bookmarks would still work, and they would wind up at a ColdFusion page, totally transparent to them.

    straffenpAuthor
    Known Participant
    August 26, 2009

    I continue to be impressed by the amount of knowledge that everyone on these forums possesses.  Thank you to all the posters in this thread for your insight, advice and experience.  I didn't mean for my question to spin off into many different directions, but it was interesting to read everyones' responses.

    To recap, my situation is this:

    The homepage of my Web site is an HTML page.

    I wanted to include content from a database, but I did not want to have to change the page extension to cfm at this time because of users' bookmarks, etc.

    The idea to use an iframe worked, but I need to figure out how to allow the iframe to resize height-wise depending on how many records are returned.

    What I'm trying to accomplish is simple, so I don't feel the need to modify my server at this time.

    Again, I appreciate all the help and insight.

    Inspiring
    August 26, 2009

    Another idea is to write a cold fusion version of your home page.  Then modify the html version so that it takes users to the cold fusion version.

    You can do this with either javascript or meta refresh.  With either method you can make it happen instantly, or you can introduce a delay and display a message asking people to update their bookmarks.

    straffenpAuthor
    Known Participant
    August 26, 2009

    Dan,

    I thought about doing that, too, but I try to stay away from redirects because I don't that if a user tries to back out of the site they hit the redirect page and get sent forward again.  I may sound ignorant here, but is there a way to bypass what I just explained?

    Thanks.

    BKBK
    Community Expert
    Community Expert
    August 25, 2009
    Is there any way to use ColdFusion code in an HTML page?...but I don't want to have to save the page as a .cfm file.

    That's a contradiction in terms. It's the CFM extension that makes it a Coldfusion presentation page.

    ilssac
    Inspiring
    August 25, 2009

    BKBK wrote:

    Is there any way to use ColdFusion code in an HTML page?...but I don't want to have to save the page as a .cfm file.

    That's a contradiction in terms. It's the CFM extension that makes it a Coldfusion presentation page.

    To be fair, what extension(s) that are used to define a 'ColdFusion presentation page' is configurable.  And one can use any extension, even personal extensions, if one chooses to do so.

    Of course I have never felt it was worth the bother, so I have never actually tried to do this, but I have often read about the mechanics invloved, and it seems pretty straight forward to convince one's web server and ColdFusion application server to process .htm files or any other desired extensions.

    BKBK
    Community Expert
    Community Expert
    August 25, 2009
    To be fair, what extension(s) that are used to define a 'ColdFusion
    presentation page' is configurable.  And one can use any extension,
    even personal extensions, if one chooses to do so.

    I have assumed Straffenp's statement means he would still say "but I  don't want to have to save the page as an .abc file", if Coldfusion files used the ABC extension.

    ilssac
    Inspiring
    August 24, 2009

    The answer to what you actually ASKED: NO, you can not put CFML into an HTML page.  ColdFusion runs on the client first and HTML runs on the browser aftwords.

    To answer what I think you mean.  It is possible to tell your web server (i.e. IIS or Apache, etc) to send .htm files to the ColdFusion application server so that it will excecute any CFML code if finds.  Exactly how you do this depends specifically on which web server you are using and what version of ColdFusion you are running.  The internet has many blogs and tutorials explaining the process.  A Google search would probably find some of them.

    tclaremont
    Inspiring
    August 24, 2009

    Can you use an inline frame to include the ColdFusion page?