Hey guys I am building a page to validate html using php tidy
I have it working fine but I want to format the repaired output with
indents to make it look good and I cant figure it out. any ideas would be great here is the code I am using
Code:
<?php
$file= $_POST['file'];
$tidy = tidy_parse_string($file);
$tidy->_error_count;
echo "The following errors were detected:<br>";
preg_match_all('/^(?:line (\d+) column (\d+) - )?(\S+): (?:\[((?:\d+\.?){4})]:)
?(.*?)$/m', $tidy->errorBuffer, $tidy_errors, PREG_SET_ORDER);
$malestr = str_replace("line","\nline:",$tidy->errorBuffer);
$article1=nl2br(htmlentities($malestr));
echo "$article1<br>";
$tidy->CleanRepair();
echo"<textarea cols=\"80\"rows=\"30\">$tidy</textarea>";
?>