[TIP] Indent Table Elements
Table problems are one of the most common problems that people run into when editing their templates. Forget to close a tag and your entire site can become crippled. To help fix this problem before it starts, I recommend that you indent each element when using tables. By simply adding a tab, or a few spaces to your code, you can make it easier to see if there's a problem with your code.
Compare the following two code samples and you'll see what I mean: Code:
<!-- without indents --> Code:
<!-- with indents --> You'd be surprised at what a difference something as simple as this can make. :) |
Another good point. I work with an editor that formats code (if I want it to) very similarly.
|
Yes thats how it's set in most template mods and the default templates. Much easier. :)
|
Indenting by using a TAB space is usually a bad idea, because the TAB character is interpreted differently on different platforms (which means you can have nice neat code on Windows, but try to edit it in Unix and you'll wonder what the hell happened).
vB uses TAB spaces everywhere, but as a general rule I stick to the '2 space' convention. That is, 2 non-breaking spaces for each indented line of code. I've also set up my text editor to do the same. It makes for very nice, clean code. |
I just space as much as the other ones are, so I don't use TAB or anything.
|
The 'other spaces' are tab spaces.
|
Note: A TAB space is an actual character, so when I use that word I am referring to the character itself, not what happens when you press the TAB key (although in almost all cases they are the same).
|
Quote:
BTW can't try it in here because of the other input spaces. |
It's not good to use them, because as I explained before you can't rely on their readability across all platforms. You can even change the size of TAB spaces to your liking in various programs, so you can pretty much be sure that your code will look different for everyone if you use TAB spaces instead of non-breaking spaces.
|
I never indent table elements, because ive known about the issues as i use both windows and linux, and i can read my code very well without them anyway.
|
I can live with both, but I find it a little easier. It don't really matter anyway much to me. :)
|
Yeah it's usually easier... especially when you're dealing with a lot of nested tables. If you see a big jump in indents, that suggests you've either missed a few closing tags, or forgotten them.
Example: Code:
<table> Code:
<table> |
I agree, I prefer the second way but I don't mind. I mean I can still spot errors without the indents but it could be harder. :)
|
Plattopus: upload your files in ASCII mode and there will be no problem with character coding ;)
I often edit files on windows and after upload there is no diffrence from the one made on BSD :) |
There is a difference, it might just be luck that both of the programs you used are configured similarly.
|
Good points plattopus. My text editor intreprets the Tab and then inserts the number of spaces that you've set.
For those of you editing in multiple OS's, plattopus' idea about using spaces is a good one. Either way, indention can help. :) |
I've set my text editor (Edit Plus 2) to do the same thing... that way, I can use the TAB key (which is far more convenient than pressing space 4 times) and it will insert 4 non-breaking spaces instead of a tabspace.
But the point is, indentation is a MUST for readability. |
That's the same text editor I use! :D
|
All times are GMT. The time now is 11:36 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|