Page 1 of 1

Format HTML, Javascript nicely???

Posted: Thu Mar 09, 2006 4:45 pm
by alex.barylski
Edit: I should also note that it NEEDS to be written in native PHP (4 or less) or Javascript...no C libraries or PHP extensions, etc...please

Edit: After a quick search on google...I've realized I'll likely have to say JUST HTML and NOT PHP. I need something written in Javascript or PHP which beautifies ONLY HTML and Javascript (would be nice).

Anyone know fo any PHP or preferably Javascript code which would take a massive string of HTML and Javascript, CSS, etc...

And format it nicely with indentation, etc?

I'm looking for something I can use it in a commercial app without restrictions so long as the source doesn't change.

Thanks a bunch :)

Posted: Thu Mar 09, 2006 6:19 pm
by Chris Corbyn
Isn't that what PHP's tidy_...() functions are for?

http://uk2.php.net/tidy

Posted: Fri Mar 10, 2006 12:07 am
by alex.barylski
Yup...didn't realize PHP had a binding for it though :oops:

Only problem with that is...you need libtidy installed...I hate dependancies like that...

Cuz my software will be likely run on bare bones machines...shared servers without all the bells and whistles...

I'll use it anyway :)

Cheers