note 39579 deleted from ref.tidy by nlopess
| From: | nlopess@php.net | Date: | Tue, 03 Feb 2004 14:56:42 +0000 |
| Subject: | note 39579 deleted from ref.tidy by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64598@lists.php.net to get a copy of this message | ||
Note Submitter: tjhughes@iinet.net.au
----
just a simple way of using tidy - thought i would share it b/c it has taken me a while to work it
out - tested on WinXP
Apache/2.0.48 (Win32)
PHP Version 4.3.4
libTidy Build Date : 1st August 2003
for this to work you need 'tidy' set up for php see http://au.php.net/manual/en/ref.tidy.php
this function needs to be called by ob_start() like this:
ob_start("ob_handler");
and you should end up with beautiful xhtml
function ob_handler($buffer){
tidy_setopt('clean', 1);
tidy_setopt('indent', 1);
tidy_setopt('indent-spaces',2);
tidy_setopt('output-xhtml', 1);
tidy_setopt('wrap', 200);
tidy_setopt('add-xml-decl', 1);
$buffer = tidy_repair_string($buffer);
return $buffer;
}