Copy link to clipboard
Copied
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:
I suspect that an include file or application.cfm/application.cfc is responsible for the addition. Can you post your code?
Copy link to clipboard
Copied
I suspect that an include file or application.cfm/application.cfc is responsible for the addition. Can you post your code?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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