Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Sep 2007 01:33:15 +0200
From:      Olivier Regnier <oregnier@oregnier.net>
To:        freebsd-questions@freebsd.org
Subject:   CGI with html
Message-ID:  <46E08E3B.7050407@oregnier.net>

next in thread | raw e-mail | index | archive | help
Hi everyone,

I try to write CGI scripts but i have a problem on my screen.

Here is my CGI code
# ------------------------------------
#!/usr/bin/perl

use strict;
use warnings;

# MODULES
use CGI qw(:standard);

# VARIABLES
my $style = get_style();

# HTML PAGE
print header,
      start_html (
         -title   => '403, Interdit',
         -style   => {-code => $style },
      ),
      end_html;

# CSS style
sub get_style {
    my $content = "body {\n"
      . "margin:150px;\n"
      . "padding:0px;\n"
      . "padding:0px;\n"
      . 'font-family: "tahoma", "verdana", "arial", "helvetica";'. "\n"
      . "font-size:80%;\n"
      . "color:#666666;\n"
      . "}\n"
      . "#error {\n"
      . "margin:0 auto 0 auto;\n"
      . "padding:10px;\n"
      . "width:370px;\n"
      . "text-align:left;\n"
      . "font-size:8pt;\n"
      . "background-color:#EEEEEE;\n"
      . "}\n"
      . "#error h1 {\n"
      . "margin-top:5px;\n"
      . "margin-bottom:10px;\n"
      . "font-size:10pt;\n"
      . "color:#333333;\n"
      . "}\n"
      . "#error a {\n"
      . "color:#DC298D;\n"
      . "}\n"
      . "#error a:hover {\n"
      . "color:#FFFFFF;\n"
      . "background-color:#DC298D;\n"
      . "text-decoration:none;\n"
      . "}\n";
      return $content;
  }
# ------------------------------------
and here is the result in html:
# ------------------------------------

<!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" lang="en-US" xml:lang="en-US">
<head>
<title>403, Interdit</title>
<style type="text/css">
<!--/* <![CDATA[ */
body {
margin:150px;
padding:0px;
padding:0px;
font-family: "tahoma", "verdana", "arial", "helvetica";
font-size:80%;
color:#666666;
}
#error {
margin:0 auto 0 auto;
padding:10px;
width:370px;
text-align:left;
font-size:8pt;
background-color:#EEEEEE;
}
#error h1 {
margin-top:5px;
margin-bottom:10px;
font-size:10pt;
color:#333333;
}
#error a {
color:#DC298D;
}
#error a:hover {
color:#FFFFFF;
background-color:#DC298D;
text-decoration:none;
}
/* ]]> */-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
</body>
</html>
# ------------------------------------

I would like to have this dtd:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;
and this meta code, <meta http-equiv="Content-Type" content="text/html; 
charset=iso-8859-1" /> is not at the good place. Logically he is before 
CSS style.

Can you help me please ? Sorry for my english.

Thank you in advance.

Olivier



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46E08E3B.7050407>