views:

50

answers:

2

When you look at the source code of PHP generated output usually everything is on one line, it makes it very hard for front end developers to read the code and trouble shoot.

So is there a way to get PHP generated output to go from this:

<ul><li>Hello</li><li>Hola</li><li>Bonjour</li></ul>

to

<ul>
    <li>Hello</li>
    <li>Hola</li>
    <li>Bonjour</li>
</ul>

WITHOUT using /n line breaks all over the server side code which just makes that messy.

+1  A: 

You could use the tidy PECL extension - see this related question for examples.

Paul Dixon
+1  A: 

I make use of a class I wrote for myself to solve the problem you're describing. A version of the code can be found here. There is probably much more polished code out there for this purpose, but this class is very much suited for my personal needs, and besides that it is very lightweight at a few hundred lines. Anyway, I post it in case it gives you any ideas, or anybody finds it interesting.

Hammerite
nice one. you should put it on gihub or a blog with docs :D
Adam Ramadhan