Jump to content

session_start() Messing up site design


zVirx

Recommended Posts

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

 

Link to comment
Share on other sites

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 >.>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.