For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > January 2007 > how to force html4 output









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to force html4 output
Oliver Block

2007-01-11, 7:55 am

Hello list,

first of all a blessed 2007 to all of you.

Can anyone tell me, if there is a way to force CGI.pm to deliver the html code
with a DOCTYPE switch for HTML4 and not XHTML?

As there are some problems with the media type for XHTML I'd rather prefer
HTML 4.

Regards,

Oliver

David Dorward

2007-01-11, 7:55 am

On Thu, Jan 11, 2007 at 02:49:31AM +0100, Oliver Block wrote:

> Can anyone tell me, if there is a way to force CGI.pm to deliver the
> html code with a DOCTYPE switch for HTML4 and not XHTML?


$ perl
use CGI qw/:standard -no_xhtml/;
print start_html(); (^D)
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-US"><head><title>Untitled Document</title>
</head><body>

Unfortunately it outputs Transitional rather then Strict, and I'm not
aware of any way to override that.

I've always been unimpressed by the CGI.pm markup generation
facilities, I find that its easy to craft something of decent quality
by using Template-Toolkit (or HTML::Template, or etc. etc. etc.).

--
David Dorward http://dorward.me.uk

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com