I'm querying a database, and printing results in a table. I'm the kind of person that likes to have tr indented 2 spaces from the table tag, and td indented 2 spaces from tr. What I'm doing right now is:

There is also HTML Tidy for PHP, but that may be going too far for your needs, http://www.coggeshall.org/tidy.php

On my website I don't care about indenting HTML at all. If you look at the source code of this webpage you will see there are not even line breaks (well, only a bit as required by JavaScript), http://skyscraperpage.com/members/

Grant Palin

12-03-2003, 04:37 AM

Originally posted by Dylan Leblanc
There is also HTML Tidy for PHP, but that may be going too far for your needs, http://www.coggeshall.org/tidy.php

Thanks, but I think that's going too far for my needs;).

http://skyscraperpage.com/members/

Yikes, that's a mess!:eek:

bcarl, I'll try your suggestion.

Grant Palin

12-03-2003, 07:33 AM

All right, the new line character is helpful (so every HTML tag in the output source is on it's own line). When I used the tab character, it indented by 8 spaces...I prefer 2 space indents in my HTML documents, so that's no good. So I'm more or less back to where I was before. But that's okay, since I'm not having to do that indenting too often.

Dylan Leblanc

12-03-2003, 07:50 AM

I think the 8 spaces is a result of the program you are using to view the html document, since tabs are sometimes different widths in different programs. Sometimes there are even settings in the program which you can change the width of the tabs.

I made my webpages without any newlines because html documents don't need them.

raf

12-03-2003, 02:01 PM

On my website I don't care about indenting HTML at all. If you look at the source code of this webpage you will see there are not even line breaks
I'll second that. I've never had any need to bother with my xhtml-sources layout. (But then again, i never make mistakes so i don't need to look at the xhtml-source when debugging ;) )

ReadMe.txt

12-03-2003, 04:42 PM

But in the interests of visibility and readability for bothmyself if i want to change something, and other people who are using my html - i want it to be laid out neatly and structured using a bit of whitespace.

Acecool

12-03-2003, 05:02 PM

highlight_string($string);

It keeps spaces and highlights php etc

bcarl314

12-03-2003, 07:12 PM

Originally posted by Grant Palin
All right, the new line character is helpful (so every HTML tag in the output source is on it's own line). When I used the tab character, it indented by 8 spaces...I prefer 2 space indents in my HTML documents, so that's no good. So I'm more or less back to where I was before. But that's okay, since I'm not having to do that indenting too often.

The number of spaces displayed is directly related to your text editor. Check the configuration of your text editor and set the spaces per tab (or something similar) to 2.

Alternativly, I think you can use \s for a space character. Not sure though