Jens,
I would suggest that you try writing a script that keeps track of how many tags have been opened (look for "<"), versus how many tags have been closed ("[^>]*/>") on a line-by-line basis. Using that number, you should be able to indent the code properly.
I need to count how often the important tags (table, tr, td) have been opened, but that's only a part of the solution. It doesn't make sense to count every < and > because most of the tags don't play a role (in the script I should write).
Let us know what you've got so far.
I solved the problem by first getting all position of the table, tr and td-tags. After that I go serially from the first to the last occurence of a tag and keep track how often it was opened and closed. Additionally I have a variable which counts the numbers of bytes I added to the text. After that I reduce the linelength to less than $maxlength chars.
Jens
PS: If you want a tool which really cleans up HTML you should use HTMLTidy of course. :)
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php