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>"; ?>
Your the php expert, but here are some thoughts. Try using CSS to format your Textarea element. There is always the old trim() but your browser will collapse contiguous whitespace. maybe these links will help - they are for cleaning up source code - but it gives you an idea. http://www.vim.org/scripts/script.php?script_id=1120 http://www.bierkandt.org/beautify/
LOL I did figure it out though. It cleans up code nice I will post a link when it is looking good. Right now I used a page from my back pain articles section for a template so it looks goofy untill I change the other content.