Re: tags to lowercase
| From: | Jeff Harris | Date: | Wed, 30 Jul 2003 04:53:59 +0000 |
| Subject: | Re: tags to lowercase | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157484@lists.php.net to get a copy of this message | ||
On Jul 30, 2003, "Curt Zirzow" claimed that:
|* Thus wrote Justin French (justin@indent.com.au):
|> Hi all,
|
|hello.
|
|>
|> has anyone developed or know of a function to convert all tags to
|> lowercase, but still preserves the contents of the tags and the content
|> of the attributes of the tags?
|
|nice little tool:
|http://tidy.sourceforge.net/
|
|Some one built a function that uses that tool to filter, you'll
|have to search the archives, cause I dont know of it off hand.
|
|
|Curt
I use tidy built into my scripts. In your tidy config file you can set
covert to lower case, indent, output XHTML or whatever. Curt refers to
phpTidyHt which basically does the same thing but with a function call.
Most pages come out crisp and clean. The others are inherently wacked and
need fixing anyway.
<?php
ob_start();
// process stuff
print("</body></html>");
$str = addslashes(ob_get_contents());
$fp = popen("echo \"" . $str .
"\" | /path/to/tidy -config /path/tidy/config", "r");
$newstr = "";
do {
$data = fread($fp, 999999);
if (strlen($data) == 0) {
break;
}
$newstr .= $data;
}
while(true);
pclose($fp);
ob_end_clean();
$modtime = filemtime($_SERVER['PATH_TRANSLATED']);
$gmt_modtime = gmdate('D, d M Y H:i:s', $modtime). ' GMT';
header("Last-Modified: " . $gmt_modtime);
header("Content-length: " . strlen(stripslashes($newstr ) ) );
echo stripslashes($newstr);
?>
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc |
gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.