/    Sign up×
Community /Pin to ProfileBookmark

Is it just preference?

Hello,

Question for you. ?

On different sites, source code is viewed differently. For example, some sites nicely align their source code like:

[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en” dir=”ltr”>
<head>
<title>..</title>
</head>

<body>
<p>Text</p>
</body>
</html>
[/code]

Where as others have everything aligned left, such as:

[code]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en” dir=”ltr”>
<head>
<title>..</title>
</head>

<body>
<p>Text</p>
</body>
</html>
[/code]

Is it just preference on how it is done, or are there any “benefits” for each? Ours is aligned like the first, and it seems to me, in my opinion, a waste of bandwidth.

Thanks in advance.

Regards,

to post a comment
HTML

90 Comments(s)

Copy linkTweet thisAlerts:
@FangJun 27.2004 — It's a matter of preference, but with nested elements the indented method is easier to comprehend, especially if more than one person is working on the site.

A waste of bandwidth? Yes, but you can always remove all unnecessary white-space from a copy of the page and upload that.
Copy linkTweet thisAlerts:
@David_HarrisonJun 27.2004 — I always use method number 2, I just think it's a waste of time to put all the tabs in. I also find it harder to work on code that is indented, so if I'm bug fixing I'll always convert the code first.

Instead of indenting, I just use different numbers of line breaks and don't usually open two tags on the same line.
Copy linkTweet thisAlerts:
@IncaWarriorJun 27.2004 — I like it indented because it's easier to keep track or what tags I've used when I'm editing it.
Copy linkTweet thisAlerts:
@DanUKauthorJun 27.2004 — Okay, thank you. ?
Copy linkTweet thisAlerts:
@PeOfEoJun 27.2004 — I use indenting because all the cool people use it. ?. Its easy to see what tags are open and closed and keeps me more organized and I can know where I am when I am sifting through piles of code. It is also courtesy if someone else needs to look in my code, they can find stuff faster. Lavalamp does not indent, thus making him not cool, because [i]all[/i] of the cool people indent.
Copy linkTweet thisAlerts:
@David_HarrisonJun 27.2004 — [i]Originally posted by PeOfEo [/i]

[B]Lavalamp does not indent, thus making him not cool, because [i]all[/i] of the cool people indent.[/B][/QUOTE]
? *sniff* Well how's that for peer pressure?
Copy linkTweet thisAlerts:
@PeOfEoJun 27.2004 — INDENT, INDENT, INDENT AND YOU WILL BE SAVED.
Copy linkTweet thisAlerts:
@David_HarrisonJun 27.2004 — Well the way I see it, you're weak because you give into temptation and peer pressure to indent, therefore you're in league with the devil (because of the temptation) and are evil.

So I conclude that anyone who indents is condemned by God and automatically goes to hell when they die.

Have a nice life. ?
Copy linkTweet thisAlerts:
@PeOfEoJun 27.2004 — indention can make things clear, much like a light in the dark. Notice the symbolism. Not indenting is living in darkness, or evil. Indent and you will be saved... amen.
Copy linkTweet thisAlerts:
@David_HarrisonJun 27.2004 — So indenting makes thing easier does it? The good path is hard and steep and paved with thorns, those who are not strong will take the easy path which will undoubtedly lead them to hell. ?
Copy linkTweet thisAlerts:
@Ben_RogersJun 27.2004 — You guys are getting worse than Rob, with his Dark God of XHTML! Indenting is 3vil. And, as we all know, 3v1l pwns. ?
Copy linkTweet thisAlerts:
@rhsundergroundJun 27.2004 — perhaps it is easier to read and see what tags you've used, closed, etc., but it sure is a pain in the arse to clean up code like that.

the cool people may indeed, but the nerds still rule the world.?
Copy linkTweet thisAlerts:
@Ben_RogersJun 27.2004 — I like to think of it as 'c00l pplz', or 'cool nerds'. Same thing, if you think about it... think, now... :p
Copy linkTweet thisAlerts:
@IncaWarriorJun 27.2004 — well our indenting is harder to implement but helps us in the long run. Isn't that better then you short term people.

White space is your friend.
Copy linkTweet thisAlerts:
@PeOfEoJun 27.2004 — If you come back to edit your site in 6 months with no indents you will be sorry. Plus its not like dw does not keep track of my indents.
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — True... but if you're not going to touch a site for 6 months, you should delete it, IMO.
Copy linkTweet thisAlerts:
@DanUKauthorJun 28.2004 — I guess under our circumstances, as our developers don't use any "programs", just a plain text editor to create all our seperate sites, we could get rid of the indenting, and then when it comes to editing, use the HTML Tidy program (so simple).

This I suppose is depedant on the situtation, for us, all our sites use a header.php/footer.php that's include'd via PHP into all files, so it wouldn't cause a problem for us. I'm looking at how much, across all sites, the bandwidth would be reduced. I doubt by much, and if it's totally minimal, there's no point in removing it. ?
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — I'm the only developer on my site I guess, and I mainly indent out of habit. I use ctrl+f to find where I want to be anyways (semantic code makes this s0Oo much easier)... I guess indentation just looks good ?
Copy linkTweet thisAlerts:
@PeOfEoJun 28.2004 — [i]Originally posted by omega [/i]

[B]I'm the only developer on my site I guess, and I mainly indent out of habit. I use ctrl+f to find where I want to be anyways (semantic code makes this s0Oo much easier)... I guess indentation just looks good ? [/B][/QUOTE]
It looks good because it is good :p. Look indenting is right, if your not indenting, well then you are wrong.
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — Riiiight, Peo. As for the original q: It is most definetely preference.
Copy linkTweet thisAlerts:
@webanimalJun 28.2004 — Indention, like most everything else, is good with moderation. I believe some people are compulsive indenters. I use indentation sometimes for nesting tables, but I use comments to mark the code. I also indent, when the page displayed is indendented, as in blockquotes. Some people's code looks like they are trying to draw a picture of something. What do you call that? I forget.
Copy linkTweet thisAlerts:
@Daniel_TJun 28.2004 — [i]Originally posted by webanimal [/i]

[B]I believe some people are compulsive indenters.[/B][/QUOTE]
These forums, for example :p View the source code of any thread page on these forums, and scroll down to the first <script> tag. :eek: Holy shat! Check out that wild indentation! :eek:
Copy linkTweet thisAlerts:
@David_HarrisonJun 28.2004 — [i]Originally posted by PeOfEo [/i]

[B]Look indenting is right, if your not indenting, well then you are wrong.[/B][/QUOTE]
Sorry maddox, I guess I'm wrong.[i]Originally posted by webanimal [/i]

[B]Some people's code looks like they are trying to draw a picture of something. What do you call that? I forget.[/B][/QUOTE]
ASCII art?[i]Originally posted by webanimal [/i]

[B]I use indentation sometimes for nesting tables[/B][/QUOTE]
Not only do you use tables, but you nest them. ?
Copy linkTweet thisAlerts:
@webanimalJun 28.2004 — These forums, for example View the source code of any thread page on these forums[/QUOTE]

Code indentation on here is minimal. I'm talking about when everything but the first line is indented. Very confusing! I am a very lazy coder, so I have to use comment tags to tell me where everything starts and ends - like columns and navigation links.
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — Heh. I used to do that... when I used [url=http://projep.t35.com/vintage/v1/]tables for layout[/url]. Not as psychotic with it now, MUCH, easier to see what I'm doing with CSS. So much easier to style and code for, too. All the results are better, it's more flexible, and faster, too. CSS is just so much more practical for visual needs than tables, you know what I mean? Oh, wait, you wouldn't. You still use tabls for layout... ?
Copy linkTweet thisAlerts:
@IncaWarriorJun 28.2004 — I like tables for layout, they add a nice sort of padding to my source
Copy linkTweet thisAlerts:
@David_HarrisonJun 28.2004 — [i]Originally posted by IncaWarrior [/i]

[B]I like tables for layout, they add a nice sort of padding to my source[/B][/QUOTE]
Weirdo.
Copy linkTweet thisAlerts:
@webanimalJun 28.2004 — I use css sometimes, mostly local, but I still prefer tables for much of what I do. Of course, that will change with time. I don't use ssi much either, except to run server side scripts.

Anyway, back to the subject. I submitted my code to a reviewer bot one time. It sent back code that was indented every which way, and I spent awhile sorting it back out, and finally gave up. Went back to my code. (You code sniffers!)
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — I'm not even going to bother with the standard why CSS should be used schpeil... Ryan REALLY needs to get that on WebDev Faqs tho...
Copy linkTweet thisAlerts:
@PeOfEoJun 28.2004 — [i]Originally posted by lavalamp [/i]

[B]Sorry maddox, I guess I'm wrong[/B][/QUOTE]
?
Copy linkTweet thisAlerts:
@Paul_JrJun 28.2004 — I will set things straight here, people.

Indenting is evil. Not the cool kind of evil, but the bad kind, the kind that shall damn you to a fate worse than you can possibly imagine. You shall endure an eternity of pain and torture; all punishment for your most horrible sin of indenting.

The only code I indent is my scripting. If I didn't, then by now I'd be bald, have a few ulcers, and probably be more insane than I already am. I do not indent my mark up; I smush it together to make it as unreadable as possible to everyone but me.

Oh, and Peo, I can come back to my mushed-up code six months later and still understand it quite easily. ?
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — Well, Paul, tell me: how could it be straight if it's associated with you? ? Just kiddin'. I like to indent cuz.. it's eas. I indent for the same reason I use valid code. It makes things simpler. I don't really beleive all the reasons I've read about why to use valid code, I have no reason to, no proof. Same about indentation. It simply makes life easier.

No flaming, arguing, trolling, etc.,etc. Plz.
Copy linkTweet thisAlerts:
@David_HarrisonJun 28.2004 — [i]Originally posted by Paul Jr [/i]

[B]I do not indent my mark up; I smush it together to make it as unreadable as possible to everyone but me.[/B][/QUOTE]
YEAH!!! That's the way it should be. ?

I don't indent my scripting either, but I lay it out in a way that (hopefully) makes it easier to understand.
Copy linkTweet thisAlerts:
@DaveSWJun 28.2004 — [i]Originally posted by omega [/i]

[B]I'm not even going to bother with the standard why CSS should be used schpeil... Ryan REALLY needs to get that on WebDev Faqs tho... [/B][/QUOTE]

So write one and submit it.

Anyway, I don't indent my code because it's hand written in html-kit. In consequence it's far superior to anything indented because it's hand written. I have such clean code I don't need to resort to indenting to see where I am. ? [i]That's xhtml-god philosophy.[/i]

Also when you have indented long lines of code it screws it up when it line-wraps. If you don't indent it it's just as readable whatever you do.
Copy linkTweet thisAlerts:
@webanimalJun 28.2004 — What wuz the question again?

O yea! This web forum code is in tables. I know! I know! It's dynamically generated. I still like my tables an my notepad.
Copy linkTweet thisAlerts:
@DanUKauthorJun 28.2004 — Has anyone actually done any analysis of how much bandwidth indentation, generally, wastes? ?
Copy linkTweet thisAlerts:
@FangJun 28.2004 — Less than 5%. Your code needs to be valid ,especially JavaScript.

A bigger reduction can be achieved by compressing graphics or reducing the number of graphics.

This provider, [URL=http://www.onspeed.com/]Onspeed[/URL] , does all this and more(claims are exaggerated).
Copy linkTweet thisAlerts:
@Robert_WellockJun 28.2004 — Who summed the Dark God of XHTML he hears through the ears of many...

Indentation of both programming code and script is a sensible philosophy only the stupid or foolhardy don't indent script and as for these highlighting IDE's, well you cannot rely on such opulence; notepad is the tool of the trade.

A good coder does not indent code for his own benefit, he does it for the benefit of others. For those who dost not indent a plague of code-locusts will feast upon thy sinuses unto eternity and beyond.

If thee do not use indention for such sorcery then yea shall prove this by coding one long wandering line of code; gaze upon one of my non-indented pieces and try decipher where I placed the errors of code judgment - compared to the indented version - I challenge all.

Indentation bandwidth consumption is according to byte value each character has equal status whether it is a letter or a space.
Copy linkTweet thisAlerts:
@IncaWarriorJun 28.2004 — yeah I was going to say that
Copy linkTweet thisAlerts:
@webanimalJun 28.2004 — Is this like a cult or somthin?
Copy linkTweet thisAlerts:
@nichalpJun 28.2004 — Interesting post. Suppose we knock off all spaces, tabs and carriage returns so that the entire code is in one line, will it save bandwidth?

Logically, I feel that spaces etc. consume space. So does it consume valuable bytes?
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — Sure you were, sure you were, Inca God. Lol, you must have an ego problem, calling yourself that. May Shiva or who-ever-else smite you. And good. :p

Rob... I don't even know what to say. Did the DGoXHTML tell you that, too? (J/k). He really needs a page devoted to him. Lol, start a cult, why not? I'd join :p (Visit start-a-cult.com for more details) I think that the original idea is what's right though.

Indenters are cool. Everyone else is a poser. ?
Copy linkTweet thisAlerts:
@webanimalJun 28.2004 — I wuz wonderin. Do the girls think guys who indent are cool? I mean if I indent, will I get lots of girlfriends? Also, do any of you people, who think indenting is cool, wear pocket protectors?
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — No, and no; we're kidding, obviously, unless I'm the only one here being sarcastic... :rolleyes: Who knows, with these [i]freaks[/i]? :p
Copy linkTweet thisAlerts:
@spufiJun 28.2004 — [i]Originally posted by omega [/i]

[B]True... but if you're not going to touch a site for 6 months, you should delete it, IMO. [/B][/QUOTE]


You make a website for a cliet that uses a CMS that you built and you don't really have to touch it for six months. They now want you to come back and add/tweak something. Looking at what looks like one great big column can be a little overwhelming.

Also, pure HTML may be doable on some level without indents, but once you start adding things like server side code and databases, I can't imagine weeding through all of that without indents. Using indents really helps in seeing the code range of things like loops, functions, if/case statements. I think of it almost like not using color coding. Sure it can be done, but why go through all of the hassle of not using it? ?
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — Well, I can't relate as I've never had any clients, but I can see your point. I do indent my scripts- especially since I have a bad habit of forgetting the ending curly brace.
Copy linkTweet thisAlerts:
@David_HarrisonJun 28.2004 — [i]Originally posted by Robert Wellock[/i]

[B]Who summed the Dark God of XHTML he hears through the ears of many...[/B][/QUOTE]
So you got a PM then?[i]Originally posted by Robert Wellock[/i]

[B]gaze upon one of my non-indented pieces and try decipher where I placed the errors of code judgment - compared to the indented version - I challenge all.[/B][/QUOTE]
Bring it.[i]Originally posted by webanimal[/i]

[B]Is this like a cult or somthin? [/B][/QUOTE]
You'd think so wouldn't you.[i]Originally posted by webanimal[/i]

[B]I wuz wonderin. Do the girls think guys who indent are cool? I mean if I indent, will I get lots of girlfriends?[/B][/QUOTE]
No, but you would have if you dropped the tables, since I did life has been one big pool party. ?[i]Originally posted by omega[/i]

[B]He really needs a page devoted to him.[/B][/QUOTE]
He's got one. :rolleyes:

To anyone who indents, [i]so far[/i] I've found that it's not neccesary if you layout the code correctly. Although with scripts it can get a little sticky sometimes I grant you (that's server-side as well, I code in ASP).
Copy linkTweet thisAlerts:
@spufiJun 28.2004 — [i]Originally posted by omega [/i]

[B]Well, I can't relate as I've never had any clients, but I can see your point. I do indent my scripts- especially since I have a bad habit of forgetting the ending curly brace. [/B][/QUOTE]


I've only done sites for friends, but I programmed in Cobol/CICS for four years, and looking through programs that have at least 1,500 lines of code quickly makes you get used to the idea of indenting.
Copy linkTweet thisAlerts:
@Ben_RogersJun 28.2004 — There's a site for the DGoXHTML? I musta missed it ?

Heh. It seems everyone here is a programmer but me. I wish I could say the same for myself, but I can't... the most coding I've ever done is my original blog, which turned out crap anyways so I deleted it.
Copy linkTweet thisAlerts:
@DanUKauthorJun 29.2004 — Hmm I can see what you mean by indenting makes it easier for spotting errors...

But... with CSS the source code is so dramatically reduced, and simple that compared to tables, I [b]personally[/b] don't find it any harder to view...

Regards,
Copy linkTweet thisAlerts:
@webanimalJun 29.2004 — QUOTE]No, but you would have if you dropped the tables, since I did life has been one big pool party. [/QUOTE]


Well! Ok! I have been told I hafta redo my funtime page, cuz it's not fun. So, I'm gonna try to do it all with css. And if I understand you correctly, then women will just swarm my site, and I will dwell in coolness.

I am kinda hesitant tho. The last time a guy in the office told me how to get lots of girlfriends it worked out kinda messy. But, we

won't go into that.
Copy linkTweet thisAlerts:
@Ben_RogersJun 29.2004 — Lava- I meant a page dedicated to the dark god of XHTML. Not to Rob's boredom intertwined with love for coding.

Webanimal- Webdevelopment will not get you any girls... unless you get filthry rich doing it.
Copy linkTweet thisAlerts:
@Paul_JrJun 29.2004 — [i]Originally posted by omega [/i]

[B]Well, Paul, tell me: how could it be straight if it's associated with you?[/B][/QUOTE]

I'm not sure I follow...

[i]Originally posted by DaveSW [/i]

[B]Anyway, I don't indent my code because it's hand written in html-kit. In consequence it's far superior to anything indented because it's hand written. I have such clean code I don't need to resort to indenting to see where I am. ? [i]That's xhtml-god philosophy.[/i][/B][/QUOTE]

That's basically the reason I don't indent. I used to indent, but I don't need to anymore.

[i]Originally posted by Robert Wellock [/i]

[B]Indentation of both programming code and script is a sensible philosophy only the stupid or foolhardy don't indent script and as for these highlighting IDE's, well you cannot rely on such opulence; notepad is the tool of the trade.[/B][/QUOTE]

Exactly. I indent my programming code and script; just not my mark up. ?

[i]Originally posted by Robert Wellock [/i]

[B]A good coder does not indent code for his own benefit, he does it for the benefit of others.[/B][/QUOTE]

Well, if people want to steal my code, they're going to have to work a bit, if they can't understand it as it is -- which they should be able to do since my code is clean enough to eat off of. :p

[i]Originally posted by Robert Wellock [/i]

[B] gaze upon one of my non-indented pieces and try decipher where I placed the errors of code judgment - compared to the indented version - I challenge all.[/B][/QUOTE]

Okay. Let's see it..!
Copy linkTweet thisAlerts:
@David_HarrisonJun 30.2004 — OK, when the markup starts to get a little messy I have started to indent ecah nested tag by two spaces.

I agree that it does help a smidge, but I can still find my way around non-indented code no problem.
Copy linkTweet thisAlerts:
@Robert_WellockJun 30.2004 — Really you don't want to see some of the syntax junk I have had to wade through for others... I used to think nothing of going through 500 lines of other peoples code per page using notepad alone and believe me using indentation makes that task several times easier as does for balancing braces, etc.

No, my website is not a shrine to the Dark God himself.

[i]else { $choice=$_POST['chosen']; $sql = "select * from Courses_Exam where Course_code = '$choice' "; $result = mysql_query($sql); echo("<div class='center'><table border='1'>"); echo("<tr><th>Course Name</th><th>Course Code</th><th>Places Available</th></tr>"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $available = $row['Max_no'] - $row['No_enrolled']; echo("<tr><td>".$row['Course_name']."</td><td>".$row['Course_code']."</td><td>".$available."</td>"); }; echo("</table></div>");

mysql_close($cnx);[/i]


There is one or two errors in the above code if the code was indented you'ld spot one straight way.

Though was the original question about code/script or (x)html markup?

Yes the girls do flock to me, you'd notice that on my forum.
Copy linkTweet thisAlerts:
@Paul_JrJun 30.2004 — [i]Originally posted by Robert Wellock [/i]

[B][i]else { $choice=$_POST['chosen']; $sql = "select * from Courses_Exam where Course_code = '$choice' "; $result = mysql_query($sql); echo("<div class='center'><table border='1'>"); echo("<tr><th>Course Name</th><th>Course Code</th><th>Places Available</th></tr>"); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $available = $row['Max_no'] - $row['No_enrolled']; echo("<tr><td>".$row['Course_name']."</td><td>".$row['Course_code']."</td><td>".$available."</td>"); }; echo("</table></div>");

mysql_close($cnx);[/i]




There is one or two errors in the above code if the code was indented you'ld spot one straight way.[/B]
[/QUOTE]

A missing closing brace, and a semi-color after a closing brace.

But I said I don't indent my mark up; I indent my PHP. I'd be insane if I didn't.
Copy linkTweet thisAlerts:
@Ben_RogersJun 30.2004 — Heh. In a script like Rob's example. you gotta indent, but in mine, I don't, it's too simple. I could take out all extra whitespace and it'd still make sense... Anyways, as an example of much-easier-when-indented, here's Rob's script segment, 'all tidied up'.
else
{
$choice=$_POST['chosen'];
$sql = "select * from Courses_Exam where Course_code = '$choice' ";
$result = mysql_query($sql);
echo("&lt;div class='center'&gt;nt&lt;table border='1'&gt;n");
echo("&lt;tr&gt;&lt;th&gt;Course Name&lt;/th&gt;&lt;th&gt;Course Code&lt;/th&gt;&lt;th&gt;Places Available&lt;/th&gt;&lt;/tr&gt;");
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$available = $row['Max_no'] - $row['No_enrolled'];
echo("&lt;tr&gt;&lt;td&gt;".$row['Course_name']."&lt;/td&gt;&lt;td&gt;".$row['Course_code']."&lt;/td&gt;&lt;td&gt;".$available."&lt;/td&gt;");
}
echo("&lt;/table&gt;&lt;/div&gt;");
mysql_close($cnx);
}
Copy linkTweet thisAlerts:
@David_HarrisonJul 01.2004 — And here's how I'd write it:else{

$choice=$_POST['chosen'];
$sql = "select * from Courses_Exam where Course_code = '$choice' ";

$result = mysql_query($sql);

echo("&lt;div class='center'&gt;nt&lt;table border='1'&gt;n");
echo("&lt;tr&gt;&lt;th&gt;Course Name&lt;/th&gt;&lt;th&gt;Course Code&lt;/th&gt;&lt;th&gt;Places Available&lt;/th&gt;&lt;/tr&gt;");

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
$available = $row['Max_no'] - $row['No_enrolled'];
echo("&lt;tr&gt;&lt;td&gt;".$row['Course_name']."&lt;/td&gt;&lt;td&gt;".$row['Course_code']."&lt;/td&gt;&lt;td&gt;".$available."&lt;/td&gt;");
}

echo("&lt;/table&gt;&lt;/div&gt;");

mysql_close($cnx);

}
Copy linkTweet thisAlerts:
@Ben_RogersJul 01.2004 — Line breaks don't do it for me- I like to see the heirarchy; XML style indentation.

EDIT: Annoying typo.
Copy linkTweet thisAlerts:
@Paul_JrJul 01.2004 — [code=php]
else {
$choice = $_POST['chosen'];
$result = mysql_query("SELECT * FROM Courses_Exam WHERE Course_code = '". $choice . "'");
echo '<div class="center"><table border="1">' . "n";
echo '<tr><th>Course Name</th><th>Course Code</th><th>Places Available</th></tr>';
while($row = mysql_fetch_array($result)) {
$available = $row['Max_no'] - $row['No_enrolled'];
echo '<tr><td>' . $row['Course_name'] . '</td><td>' . $row['Course_code'] . '</td><td>' . $available . '</td></tr>' . "n";
}
echo '</table></div>' . "n";
mysql_close($cnx);
}
[/code]

And that's how I would've written it.
Copy linkTweet thisAlerts:
@PhillMcJul 01.2004 — I would have written it as Paul did. 'Course, then again, my niche has been software development for 7 years, I started Web Development about a year ago. I've written apps that consist of 30,000+ lines of code (like my Point of Sale and Inventory Managment System). If I didn't indent those, I would be bald trying to edit it. As for markup, I do not indent. ?
Copy linkTweet thisAlerts:
@Paul_JrJul 01.2004 — [i]Originally posted by PhillMc [/i]

[B]I would have written it as Paul did. 'Course, then again, my niche has been software development for 7 years, I started Web Development about a year ago. I've written apps that consist of 30,000+ lines of code (like my Point of Sale and Inventory Managment System). If I didn't indent those, I would be bald trying to edit it. As for markup, I do not indent. ? [/B][/QUOTE]

Solid.

Welcome to The Brotherhood. ?
Copy linkTweet thisAlerts:
@Ben_RogersJul 01.2004 — Heh. Maybe so. I still can't relate to all you programmers, as I never programmed: instead, I took up Web Development around last August. I like to indent, just because it makes life easier. Indenting markup is not crucial, it's just helpful.
Copy linkTweet thisAlerts:
@PhillMcJul 01.2004 — [i]Originally posted by Paul Jr [/i]

[B]Solid.

Welcome to The Brotherhood. ? [/B]
[/QUOTE]

? ?

I still can't relate to all you programmers, as I never programmed[/QUOTE]

Actually, Omega, Web Development is programming; it's just not as complex; although, it can be. You still go through the frustrations of little logic errors or blatent syntax errors, just like I sometimes use a '.' instead of a telescope operator '::' (C) or mispell a keyword like DIM (lol, yea I've done it) or leave the END IF off a branching statment (VB.NET). But none the less, you still piece blocks of code together to form a whole; you are a programmer. ?
Copy linkTweet thisAlerts:
@Ben_RogersJul 01.2004 — I don't consider myself a programmer, I am trying to become a designer; more fluent with actual artistic design, graphics, and CSS than in programming. I've trying PHP (end if; is in that too and I've made a heluva lot of syntax errors >_<) but I'm just not very good with it, I don't always see the logic. So, as a result, I don't make very large scripts, so they're not complex enough to make indentation [i]crucial[/i].
Copy linkTweet thisAlerts:
@PhillMcJul 01.2004 — That kind of thing just takes time. I wasn't a fluent coder the day I started! lol
Copy linkTweet thisAlerts:
@MstrBobJul 01.2004 — I'm sorry, but I haven't the fuzziest idea how anyone can not indent nested conditionals or loops. At first, I never did that, but then I spent hours labouring through a script because I had accidentally deleted a } in the middle. Drove me absolutely nuts. From that day on, I indented in scripting. But in HTML, I don't have nested elements like that, so there's really no need. Except for the pathetic suckers using table layouts...
Copy linkTweet thisAlerts:
@Ben_RogersJul 01.2004 — Actually, your markup is indented, Bob. (Check your PMs, by the way, when I checked your site I remembered something.)

And also, CSS can get just as tiresome with indented <div>s and the such... Look at [url=http://www.csszengarden.com]csszengarden.com[/url]'s source.
Copy linkTweet thisAlerts:
@MstrBobJul 01.2004 — Is it? Well not by my hand, something probably happens in the transfer from Notepad to HTML-Kit to my web editor (No FTP, I'm on a shared IP for now). Weird things happen to it in word-wrap. And, wait a second, YOU did that coding, omega! (not that I'm complaining ?)
Copy linkTweet thisAlerts:
@Ben_RogersJul 02.2004 — Heh... I have no idea what you're talking about... <eyes type="shifty" /> But, isn't it so much easier to read than if you took out all unneccessary (sp) whitespace?
Copy linkTweet thisAlerts:
@MstrBobJul 02.2004 — <eyes type="stare" style="glare:100%;" />
Copy linkTweet thisAlerts:
@Robert_WellockJul 02.2004 — Well, there you have it indentation rocks!
Copy linkTweet thisAlerts:
@pyroJul 02.2004 — I try to write code that I'd be proud if others look through it and try to learn from it. Not indenting my code would just be foolish.
Copy linkTweet thisAlerts:
@Ben_RogersJul 02.2004 — See? Even Pyro indents. Case closed. ?
Copy linkTweet thisAlerts:
@webanimalJul 02.2004 — Somewhere along the way I saw some code that put the curly's on their own line in programming code. I have used this method since:

if (yo mama iz ugly)

{

print "Yo mama iz ugly.";

}

I know this won't work in every case, especially in one-liners, but it has been very helpful for me. I still use indentation for specific functions like database functions. But, I still use lots of comments in my perl/asp/php. Makes it much easier later on.


I have changed my mind again. I am gonna redo my site with tables and css. I have been looking around, and all the major sites I visit still use tables. The web hasn't caught up with an all css format yet.

The browsers still have compatability issues. That's the reason I didn't do this before. I know tables weren't invented for page layout, but I think it is the only way for now.
Copy linkTweet thisAlerts:
@pyroJul 02.2004 — [i]Originally posted by webanimal [/i]

[B]I am gonna redo my site with tables and css.[/B][/QUOTE]
[url=http://www.hotdesign.com/seybold/]Don't[/url]
Copy linkTweet thisAlerts:
@96turnerriJul 02.2004 — i love that comic strip makes me smile everytime i see it, pyro has a point, dont
Copy linkTweet thisAlerts:
@webanimalJul 02.2004 — After we get past the workarounds and incompatability issues, then I will make a website strictly css.
Copy linkTweet thisAlerts:
@Ben_RogersJul 02.2004 — Uhm... what comic strip...? That's a good site BTW, I'll have to b/m it.
Copy linkTweet thisAlerts:
@PhillMcJul 03.2004 — [i]Originally posted by webanimal [/i]

[B]After we get past the workarounds and incompatability issues, then I will make a website strictly css. [/B][/QUOTE]


What compatibility issues?? Most if not all of CSS1 is supported in all Mainstream browsers (even IE supports it; with their own little "features":rolleyes: ) I have 6 browsers installed; (Netscape, Firefox, Avant, Opera, IE, and Safari[on a Mac VM]) and all have satisfactory CSS support. I do know one thing; all of those browsers do not handle tables the same way. That, and the fact that using tables for layout will increase the length of you code by about 20 miles. What does that have to do with it?? BANDWIDTH. SLOWER LOAD TIMES. I could go on and on, but I think you get the point. ?
Copy linkTweet thisAlerts:
@DanUKauthorJul 03.2004 — PhillMC is absolutely right.

To back up what Phill said about tables being treated different, webanimal, your site in Konqueror is completely aligned wrong.

I agree that CSS is quite hard to get into, I have spent so many hours tweaking it, but now I'm so proud our CSS works 99% correctly in:

- IE 5.5 and 6.

- Opera 6.12 and higher.

- Netscape.

- Firebird 0.8 and higher (naturally).

- Safari.

- K-Meleon.
Copy linkTweet thisAlerts:
@Ben_RogersJul 03.2004 — I still think that the biggest advantage to CSS is how much [i]easier[/i] and [i]faster[/i] it is. You can create a basic layout, and apply it to 50 pages in 3 minutes, then in another 2 minutes make it totally different.
Copy linkTweet thisAlerts:
@PhillMcJul 03.2004 — [i]Originally posted by skydan [/i]

[B]I agree that CSS is quite hard to get into...[/B][/QUOTE]


I didn't have a problem learning. I once use tables for layout... Until I ran accross CSSZenGarden and RyanBrill.com and noticed the sheer lack of....CODE. Those sites looked better than my table sites with a small fraction of the code. Then I thought less code == smaller size == less time. I immediately changed my ways, lol. (Thanks to Pyro). I then learned CSS, through and through in about 2 weeks (thanks to many of the HighRollers here). I guess it depends on experiance. By the time I came around to CSS, I had already learned several programming languages (C++, Java, Python, some ASM [that is bloody complicated! lol]BASIC, and VB.NET) and was well versed in HTML 4.01 STRICT so to me it just seemed like normal routine. It's really a lot easier to learn than you think ?
Copy linkTweet thisAlerts:
@webanimalJul 04.2004 — I agree that CSS is quite hard to get into, I have spent so many hours tweaking it, but now I'm so proud our CSS works 99% correctly in:[/QUOTE]

Who said css is hard? It's actually quite simple. It's the compatiblity issues and workarounds that I see, that makes me think they are not finish with it yet. The other day, when I decided to go all css, I went to read on the 3 col thang. I kept reading that this won't work in this browser, so use this to work around it. So, I went to another site. Same thang!

I wish I had enough traffic to worry about traffic bogging down the server. And, bandwidth isn't even in the picture in my situation.

I like my tables, and I like the way they load. I guess I should check all the browsers to see how they load.

As far as the amount of code is concerned. All the styles pages I have looked at might not have much code in the body, but they have alot in the head or external file.

If you use a wysiwyg editor, it's gonna cram all kinds of stuff like spacers in there, and that's a lot of code.

I'm just curious. What do you people think about these flash elements people are using in their pages now? I don't like it, but it looks good.

And, how do you quote several people in the same post? I can only copy and paste one at a time, and it's on a different page.
Copy linkTweet thisAlerts:
@David_HarrisonJul 04.2004 — [i]Originally posted by skydan [/i]

[B]I agree that CSS is quite hard to get into[/B][/QUOTE]
Nah, all you need is a good book, then when you've read and understood the book you need to get practice at it. Workarounds are generally used for IE because it sucks.[i]Originally posted by webanimal [/i]

[B]It's the compatiblity issues and workarounds that I see, that makes me think they are not finish with it yet.[/b][/quote]
It's not the language that's the problem, it's the browsers various implementations of it. Attached is a totally CSS start menu that I made recently with some CSS 3, if you view it in Firefox it's great, but IE just has a fit, (there's that IE is crap thing again).[i]Originally posted by webanimal [/i]

[B]The other day, when I decided to go all css, I went to read on the 3 col thang.[/b][/quote]
Attached is also a 3 column layout with fully commented source code. It uses a layout technique that Ryan (pyro) devised.[i]Originally posted by webanimal [/i]

[B]I like my tables, and I like the way they load.[/b][/quote]
?[i]Originally posted by webanimal [/i]

[B]As far as the amount of code is concerned. All the styles pages I have looked at might not have much code in the body, but they have alot in the head or external file.[/b][/quote]
Yes but all that code only needs to be downloaded once, with tables it has to be downloaded with every page, which is why CSS comes out ahead.[i]Originally posted by webanimal [/i]

[B]If you use a wysiwyg editor, it's gonna cram all kinds of stuff like spacers in there, and that's a lot of code.[/b][/quote]
So don't use a WYSIWYG editor, I know I don't.[i]Originally posted by webanimal [/i]

[B]I'm just curious. What do you people think about these flash elements people are using in their pages now? I don't like it, but it looks good.[/b][/quote]
As long as it's not content then I don't mind. Although exceptions must be made for flash cartoons such as [url=http://www.weebl.jolt.co.uk/]Weebl and Bob[/url], in this case the flash IS the content.[i]Originally posted by webanimal [/i]

[B]And, how do you quote several people in the same post? I can only copy and paste one at a time, and it's on a different page.[/B][/QUOTE]
The easiest way is to hit quote, then copy what is in the textarea and then press back and quote someone else, but what I usually to is just copy the quote code, change the name and copy and paste the quote I want.

[upl-file uuid=7dcb6adc-317f-4ef6-8537-a2d05b28dce0 size=7kB]webanimal.zip[/upl-file]
Copy linkTweet thisAlerts:
@webanimalJul 04.2004 — Yes but all that code only needs to be downloaded once, with tables it has to be downloaded with every page, which is why CSS comes out ahead.[/QUOTE]

How do you make the "Originally posted by statement"? It doesn't do that for me.

I was gonna use ssi and external style sheets, but I read somewhere that it takes longer to load external files. Load speed is a big issue for me.


So don't use a WYSIWYG editor, I know I don't.[/QUOTE]

I use notepad for all programming and coding, except for stuff like c and basic. I was just thinking maybe that's why people have so much code.


It's not the language that's the problem, it's the browsers various implementations of it. [/QUOTE]

I knew someone was gonna say that. But, you still have to change the code to make it work in the different browsers. They're still arguing over the standard. I'm just gonna wait. I still ask the question: Why are all the major websites still using tables? Even Google uses them, and they use very little code.

I have a prediction: Just about the time everyone gets converted to styles, someone will propose another change in the standards, and it will start all over again. You know Microsoft won't sit still.

For now, I'm gonna use tables and styles.

I like this forum.


?
Copy linkTweet thisAlerts:
@Paul_JrJul 04.2004 — [i]Originally posted by webanimal [/i]

[B]I still ask the question: Why are all the major websites still using tables? Even Google uses them, and they use very little code.[/B][/QUOTE]

Because I think it would cost too much and take too much time to convert a large commercial website, containing hundreds, if not thousands, of pages, to CSS. It's easier to start the right way when you are building something that large.

And about Google, that was addressed on another thread, I believe &#8212; though, I don't remember what the exact reason was. ?
Copy linkTweet thisAlerts:
@Ben_RogersJul 04.2004 — Well, google annoys me because the layout is so insanely simple, and easy to do with

CSS. I think it's going to change over time, but they don't want to do anything too different, overnight anyways. The results are technically data though, so I guess it wouldn't hurt to keep those as CSS, and the many problems of tables don't apply to such a miniscule page like the homepage, so I guess we can't complain.
Copy linkTweet thisAlerts:
@webanimalJul 05.2004 — Because I think it would cost too much and take too much time to convert a large commercial website, containing hundreds, if not thousands, of pages, to CSS. It's easier to start the right way when you are building something that large.[/QUOTE]

I believe most of their stuff is dynamically generated. They have modified partially to styles. I have done the same.
×

Success!

Help @DanUK spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...