Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beautify html output

Tags:

php

I was wondering whether there is class or something similar which I can include into my PHP pages to beautify the HTML output.

Such as putting new lines in after tags and correctly indenting so that my source code isn't only one line, I know that to the browser it doesn't matter but I wish to do this.

I have heard of http://www.php.net/manual/en/book.tidy.php but am not clear on what it does and how to implement it, i.e. I don't understand what the manual says about it.

like image 393
George Reith Avatar asked Aug 18 '11 12:08

George Reith


1 Answers

The Tidy extension is the way to go.

If you don't understand the documentation (OK, admittedly it's not very thorough), then the first results on Google for php tidy tutorials look very promising:

  • http://devzone.zend.com/article/761
  • http://www.devshed.com/c/a/PHP/Working-with-the-Tidy-Library-in-PHP-5/
like image 110
Lightness Races in Orbit Avatar answered Oct 18 '22 16:10

Lightness Races in Orbit