note 39579 added to ref.tidy
| From: | tjhughes at iinet dot net dot au | Date: | Tue, 03 Feb 2004 01:15:18 +0000 |
| Subject: | note 39579 added to ref.tidy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64577@lists.php.net to get a copy of this message | ||
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;
}
----
Manual Page -- http://www.php.net/manual/en/ref.tidy.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39579
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39579&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39579&report=yes
Search -- http://master.php.net/manage/user-notes.php