I have a webpage coded for strict xhtml 1.0. I have a php require_once statment for an authentication page, and the first thing on it is a session start function, which needs to be output first.
The problem is that both the doctype and the session headers need to go first in order for them to both be happy. What is the solution to this? It can't be that uncommon of a problem, but i haven't been able to find any other references to this specific problem. (if i leave the require once statement first, it works as needed, but the homepage doesn't validate as valid xhtml. if i put the require once after the doctype, then i get session errors because the doctype has already been sent)
I know i could leave the require_once statement first and it would be fine, but the homepage does not validate as xhtml like that because the w3c parser is expecting a doctype declaration first. I don't want to leave it like this because it bugs me knowing there is probably another way to do it correctly and i would like to find this way.
My homepage is a php page because it has alot of dynamically-generated content. All of the webpage is output for strict xhtml 1.0 though.
Start of homepage (index.php)
Start of checklogin.php page:Code:<?php require_once 'checklogin.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta> ....
Code:<?php session_start(); ....



Reply With Quote


Bookmarks