Thursday, December 18. 2003
I am happy to announce that tidy 2.0 will be available in PHP 5 starting with the upcoming Beta 3 release of PHP. Tidy 2.0 is a major step forward, allowing developers to parse multiple documents at once, have their output automatically validated and repaired through output buffering, and offers a much more robust syntax then previous versions. Although I haven't had time to document tidy 2.0 yet, it's basic functionality has not changed from 1.0. The single biggest difference is the introduction of object resources that allow you to handle multiple documents at once:
$a = tidy_parse_file("http://www.coggeshall.org/");
tidy_clean_repair($a);
echo tidy_get_error_buffer($a);
echo tidy_get_output($a);
Along side these improvements is a object-based interface for tidy:
$a = new tidy();
$a->parse_file("http://www.coggeshall.org/");
$a->clean_repair();
echo $a->error_buf;
echo $a;
If desired, the syntax can also be mixed (although not recommended):
$a = tidy_parse_file("http://www.coggeshall.org/");
$a->clean_repair();
echo tidy_get_error_buffer($a);
echo $a;
For those of you who can't wait for Beta 3 to be released, tidy 2.0 can also be found in it's usual home in the PECL repository.