zVirx Posted August 4, 2009 Share Posted August 4, 2009 Hello, i have a problem with HTML DOCTYPE.. I made a page in XHTML 1.0 Transitional made the divs/css everything in XHTML 1.0 Transitional the page printed out just fine in a test.html but when i implemented it in php and declared session_start() at the beginning of the page <? session_start(); > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteName</title> <link href="main.css" rel="stylesheet" type="text/css" /> </head> <body> SITE </body> </html> it missed up all my divs/css design.. I suppose that session_start() missed up the header, so the browser can't read the DOCTYPE.. and it drops to HTML 4.01 Transitional Because i've made a test and tried to view the page without a DOCTYPE it was exactly missed up as it was with session_start(); which was HTML 4.01 Transitional Also my design get back to normal when i delete session_start() and make the DOCTYPE first thing at the page, But then i don't have sessions. anyone encounter this problem ? how can i fix it ! should i recode the design in HTML 4.01 Transitional ?! thanks Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted August 4, 2009 Share Posted August 4, 2009 What does view source from the browser show? Quote Link to comment Share on other sites More sharing options...
zVirx Posted August 4, 2009 Author Share Posted August 4, 2009 it shows as: <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> i even validate it on w3.org and it came out a valid xhtml 1.0 .. but the design is missed up exactly as if it were html 4.01 and i don't want to be thrown off by the session_start(), but when i delete that the design get back to normal >.> Quote Link to comment Share on other sites More sharing options...
zVirx Posted August 4, 2009 Author Share Posted August 4, 2009 Declaring a DOCTYPE of the page was causing the the page to have different margin size than a page with no DOCTYPE... which was the case with the session_start() it was as if the page had NO DOCTYPE.. so i just removed the DOCTYPE and tweaked the new margin codes and its all sorted now ! although i don't feel comfortable with a page that has no DOCTYPE but thats what is working right now so if anyone know a sloution with the DOCTYPE please tell me.. Thanks. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted August 4, 2009 Share Posted August 4, 2009 I use DOCTYPEs and session_start() all the time without problems. Try changing the first line to: <?php session_start(); > Quote Link to comment Share on other sites More sharing options...
zVirx Posted August 5, 2009 Author Share Posted August 5, 2009 Thats what i'am using i just did that so the site won't highlight the html code as php anyway, the problem didn't appear until i accessed my site through a proxy you see: - session_start() and DOCTYPE on localhost was OK - session_start() and DOCTYPE online was OK - session_start() and DOCTYPE online through a proxy was NOT OK.. it missed up the design because of the session_start() being the first line not the DOCTYPE so the browser/proxy treated the page as if there wasn't any DOCTYPE. weird :S Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted August 5, 2009 Share Posted August 5, 2009 It sounds to me like the proxy is at fault then. Perhaps it is adding characters somewhere in the page? Quote Link to comment Share on other sites More sharing options...
haku Posted August 5, 2009 Share Posted August 5, 2009 Proxies often do. Try a different proxy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.