Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Too many Doctype

Explorer ,
Dec 22, 2009 Dec 22, 2009

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
523
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Dec 22, 2009 Dec 22, 2009

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

Translate
Advisor ,
Dec 22, 2009 Dec 22, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 22, 2009 Dec 22, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 23, 2009 Dec 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 23, 2009 Dec 23, 2009
LATEST

Exact!

In fact, the application.cfm template is not the only one from which I also had to remove "Line 1"; other documents included  in the application.cfm also had their own "doctype" statement.  So when I looked (using View, Source Code) at the final code generated by the CF Server after running one CFM template, I saw 3 or even 4 doctype statements all stacked up one on top of the other.  Since only the top/first one would actually be executed/taken into consideration, the one I actually needed ended up being the last one, and was totally ignored.  Which explains why my template was not working as it should.

Well noted!  You never stop learning...

Thanks and "Joyeux Noël" !

Claude

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources