Great to hear it works for you -- I wonder what I am doing wrong. Boy, I wish it worked for me.
I made some changes, with a minor bit of progress.
#maybe the next two lines can be combined -- I am not sure
use CGI::Carp qw(fatalsToBrowser);
use CGI qw/:standard :html2/;
#the standard also says if I set :html2, xhtml will go away (but it do
+esn't seem to have an effect).
#no idea how to set -dtd attributes
my $query = CGI->new;
print $query->start_html(-title=>'Argh!',
-background=>"../images/$SiteName.background.jpg",
-link=>'brown',
-vlink=>'#8b4513',
-no_xhtml=>1, #this has no effect...
-dtd=>'3.2 DTD' #this does the trick, but not listed in the standa
+rd as to how to set it -- I hope this is right...
}
And results:
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
The worst part, is trying to validate the output using the w3c validator.
Error Line 4 column 12: there is no attribute "XMLNS".
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U
+S"><head>
You have used the attribute named above in your document, but the docu
+ment type you are using does not support that attribute for this elem
+ent. This error is often caused by incorrect use of the "Strict" docu
+ment type with a document that uses frames (e.g. you must use the "Tr
+ansitional" document type to get the "target" attribute), or by using
+ vendor proprietary extensions such as "marginheight" (this is usuall
+y fixed by using CSS to achieve the desired effect instead).
This error may also result if the element itself is not supported in t
+he document type you are using, as an undefined element will have no
+supported attributes; in this case, see the element-undefined error m
+essage for further information.
How to fix: check the spelling and case of the element and attribute,
+(Remember XHTML is all lower-case) and/or check that they are both al
+lowed in the chosen document type, and/or use CSS instead of this att
+ribute.
Error Line 4 column 65: there is no attribute "XML:LANG".
Error Line 7 column 93: document type does not allow element "META" he
+re.
The element named above was found in a context where it is not allowed
+. This could mean that you have incorrectly nested elements -- such a
+s a "style" element in the "body" section instead of inside "head" --
+ or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML doc
+uments. Due to HTML's rules of implicitly closed elements, this error
+ can create cascading effects. For instance, using XHTML's "self-clos
+ing" tags for "meta" and "link" in the "head" section of a HTML docum
+ent may cause the parser to infer the end of the "head" section and t
+he beginning of the "body" section (where "link" and "meta" are not a
+llowed; hence the reported error).
Anyway, I am confused. I wish this was a bit more straight-forward. I don't understand why things are being this difficult for me -- I just wanted a simple (and valid) html document header, not having to find and set all of these complicated flags everywhere to make the output simple.
Thanks again for the help.
|