Improve html output

I was wondering if there is a class or something similar that I can include in my PHP pages to decorate the HTML output.

For example, if you put new lines after the tags and indent correctly so that the source code is not only one line, I know that this does not matter in the browser, but I want to do this.

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

+6
source share
3 answers

The Tidy extension is the way to go.

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

+3
source

An HTML cleaner or HTML order seems to be suitable for this, combined with this set of functions: http://www.php.net/manual/en/ref.outcontrol.php

http://htmlpurifier.org/ http://tidy.sourceforge.net/

0
source

Try Pretty Diff - http://prettydiff.com/?m=beautify&html This is a more complete algorithm than Tidy.

0
source

Source: https://habr.com/ru/post/895321/


All Articles