Skip to main content
Inspiring
December 22, 2009
Answered

Too many Doctype

  • December 22, 2009
  • 1 reply
  • 688 views

Hi,

My .CFM template has its doctype set as follow:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">

However, when I check the source code generated by the CF server (on bothe V7 and V8 Standard), additional Doctype statements get written above the one I wrote (and want) as follow:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

As a result, some of the CSS functions referred to in my CF file are not working as they should (or should I say not at all) as they require my original Doctype statement to work..
Does anyone know where and how this can be fixed?
Any help would probably be the best Christmas gift I could get this year!
Thanks,
Claude
    This topic has been closed for replies.
    Correct answer JR__Bob__Dobbs-qSBHQ2

    I suspect that an include file or application.cfm/application.cfc is responsible for the addition.  Can you post your code?

    1 reply

    JR__Bob__Dobbs-qSBHQ2Correct answer
    Inspiring
    December 22, 2009

    I suspect that an include file or application.cfm/application.cfc is responsible for the addition.  Can you post your code?

    cld007Author
    Inspiring
    December 23, 2009

    Indeed!!!!

    The apllication.cfm had the extra Doctype as its first line.... I removed it and the problem was instantly fixed.

    I am surprised that this is the first time this line ever was creating such a problem since the application.cfm gets inserted/executed with every .cfm file.

    THANK YOU so much... and have yourself a MERRY CHRISTMAS!!!

    Claude

    Inspiring
    December 23, 2009

    Juist a note here.  One doesn't need a doctype at the top of a CFM template per se.  The only thing that needs a doctype (or, more accurately ought to have ~) is the final completed HTML document that CF sends back to the web server.

    I see a lot of code in which people go to pains to make each CFM template a syntactically correct / valid HTML mark-up, despite the fact that there might be ten CFM templates used to compose a single HTML doc.  It's the HTML doc that ought to be syntactically correct mark-up, not each CFM template that it comprises.

    --

    Adam