Re: Doctype and replace()

by Jens Brueckmann <lists(at)j-a-b.net>

 Date:  Wed, 10 Mar 2004 00:12:00 +0100
 To:  Mikael Aktor <aktor789(at)hotmail.com>,
"hwg-techniques(at)hwg.org" <hwg-techniques(at)hwg.org>
 References:  hotmail kontent hotmail2
  todo: View Thread, Original

> Bur you are rigth, Opera should be included. I will do some testing.


Everything seems to be alright using Opera 7.23, which is the current 
version.


> So the <script> is only sent to the browser the first time the page is 
> loaded in a session. But for the W3C validator there is no session (I 
> guess). Everytime it goes through the document it is new. What the 
> validator wants, therefore, is this:
>
> <title></title>
> [etc.]
>
> --- which means that what is sent to the browser is only:
>
> <title></title>
> [etc. i.e.: no DTD == Quirks mode]

Why do you not echo the entire DOCTYPE within the php-script. Something 
like:

<?php
session_start();
if (!isset($var)) {
   echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 
Transitional//EN\"\n\"http://www.w3.org/TR/html4/loose.dtd\">\n" .
        "<html>\n" .
        "<head>\n" .
        "<script type=\"text/javascript\">\n" .
        "[make some checking];\n"
        "window.location.replace(window.location.href+'?var=value');\n"
        "</script>\n"

}

else{
session_register("var");
   echo ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 
Transitional//EN\"\n\"http://www.w3.org/TR/html4/loose.dtd\">\n" .
        "<html>\n" .
        "<head>\n" .
}

?>

I think something like this should work fine.


Cheers,

jens


-- 
Jens Brueckmann
http://www.j-a-b.net/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA