View previous topic :: View next topic |
Author |
Message |
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Sun Aug 28, 2005 2:59 pm Post subject: W3C-validation without re-writing your page |
|
|
So, today, I checked my listing-script, and it had 167 errors. Anyway, I wanted to make it XHTML 1.0 Valid fast. So i wrote this little PHP-script:
Code: | <?
if ($_SERVER['REMOTE_ADDR'] == "133.27.228.132") {
header("Content-type: text/html; charset=utf-8");
?><?php echo "<?xml version=\"1.0\"?>" ?>
<!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" xml:lang="en" lang="en">
<head>
<title>Result for http://validator.w3.org/ - W3C Markup Validator</title>
<link rev="made" href="mailto:fake@email.com" />
<link rev="start" href="./" title="Home Page" />
<style type="text/css" media="all">@import "./base.css";</style>
<meta name="keywords" content="w3c, cmxhost" />
<meta name="description" content="W3C-valid page" />
</head>
<body>
<address>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10" height="31" width="88"
alt="Valid XHTML 1.0!" /></a>
</address>
</body>
</html>
<?
die();
}
?> |
Just include it on the top of the page you want to make valid. When the W3C-bot checks your site out, it will get this valid code. You can find a good example of this script at http://cmxhost.no-ip.biz/ |
|
Back to top |
|
 |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Sun Aug 28, 2005 4:52 pm Post subject: |
|
|
Err.. so it cheats the bot?
That's retarded... -_-"
Anyways, you only really need your site to be HTML 4.01 Transitional, because all that matters is that the browser can read it. |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Aug 29, 2005 11:55 am Post subject: Re: W3C-validation without re-writing your page |
|
|
cmxflash,
Instead of avoiding the W3C validation bot, you can do something better using the PHP Tidy extension: you can use it to generate on the fly a valid (X)HTML out of your current HTML page. See http://www.php.net/tidy for some sample scripts using Tidy. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|