Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  agyat : (24 May 2013 - 05:15 PM) O Dear, Where Are You? Without Your Words This Sb Is ..
@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.
@  agyat : (19 April 2013 - 02:49 AM) There may be two possible answers for that ....
@  yordan : (18 April 2013 - 09:35 PM) however, why this mixing of capital letters in the middle of your text?

Replying to Good Comments Make Good Html.


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

wutske

Posted 27 October 2012 - 11:06 AM

Comments make the code. HTML comments aren't very widely used, but they do help, especially if you plan on modifying your layout in the future. It's also a good practice to comment the end of your functions (php, c++, java, etc) and the beginning to display what they actually do. While loops, foreach loops, if statements all pose a threat of error. All it takes is overlooking that one little '}' and there you have it. ERROR. Good advice on the comments, although I personally think you can have too many comments. Keep it informative and direct. Don't make half your document comments. =/

For a nice free text editor, I recommend HTMLKit from Chami. When you put in your javascript it automatically puts in the comment to keep older browsers from reading your script. It's a very nice editor, and very customizable. Lots of plugins for php as well. I recently used notepad++ and it's pretty good for all kinds of languages, and you can minimize your blocks effectively.


When it comes to java code and stuff like that, I never comment the end of a loop because most IDE's are capable of highlighting the end of a block and code indendation makes these things even more clear.
For HTML code on the other hand I sometime do mark the end of large div's and large tables, but only when those elements are used for layout purposes.


I almost never use comments in html unless i want to make a comment for myself.. the output php shows me as html is usually different and stuff, i never watch it, only to make valid and clean in the making period, and later when everything runs smooth i never watch the source.. maybe it is due to my html is never being very complicated, i just see it with my eyes as a web browser :D but comments due help, even if it is said: "a real programmer does not need comments, the code is obvious to him" but sometimes the codes i wrote say a year back is not so understandable, that is why I started to write comments and another reason is because i might work with other people who will edit/write it too.


Hehe, same idea :) . I still hardly use any HTML comments, even when multiple developers are working on the same project. Html comment doesn't stand out of the rest of you're code (since it's just another tag) so added a lot of comment doesn't make thing better.
We also hardly change the layout of our pages so there's no need to know what does what and why certain things are there. In case we need to change something we just start our reverse engineering using FireBug, this works much faster than understanding comments you wrote a year ago :P .

minnieadkins

Posted 31 October 2005 - 06:48 PM

Comments make the code. HTML comments aren't very widely used, but they do help, especially if you plan on modifying your layout in the future. It's also a good practice to comment the end of your functions (php, c++, java, etc) and the beginning to display what they actually do. While loops, foreach loops, if statements all pose a threat of error. All it takes is overlooking that one little '}' and there you have it. ERROR. Good advice on the comments, although I personally think you can have too many comments. Keep it informative and direct. Don't make half your document comments. =/

For a nice free text editor, I recommend HTMLKit from Chami. When you put in your javascript it automatically puts in the comment to keep older browsers from reading your script. It's a very nice editor, and very customizable. Lots of plugins for php as well. I recently used notepad++ and it's pretty good for all kinds of languages, and you can minimize your blocks effectively.

twitch

Posted 31 October 2005 - 04:40 AM

Although a lot of people are against validation, it makes us better at designing. By validating your website and routing out all of the errors, we can make better and more usable sites. Something that XML/XHTML was developed for.

Vujsa, this is a very good thread. However, I believe you failed to mention WHY we put the contents of a script in comment tags. The answer is that older browsers (IE 3.0) may not be able to perform the actions of the script, and would display it as text. By putting it in comment tags, it is kept from displaying, but the browser still reads and processors the script.

View Post

Sorry vujsa, I failed to see that you did explain, in brief, why comment tags are used in <script> tags.

Logan Deathbringer

Posted 31 October 2005 - 03:17 AM

Although I don't comment my HTML like I should, and must admit that I pay the price later on...lol. Anyone who is just starting out should comment their HTML and any scripting/programing they do. As stated by Vujsa and others this helps with revisions later on, ALSO it helps when giving a friend a copy to look over when you need help troubleshooting a page or whatever so that they can tell at a glance what you were trying to do in a certin section without haveing to pull out a 5 lb. 4 ring binder full of coding notes to track down some obscure and rarely used, by the troubleshooter, bit of code :)

Quatrux

Posted 30 October 2005 - 10:47 PM

I almost never use comments in html unless i want to make a comment for myself.. the output php shows me as html is usually different and stuff, i never watch it, only to make valid and clean in the making period, and later when everything runs smooth i never watch the source.. maybe it is due to my html is never being very complicated, i just see it with my eyes as a web browser :) but comments due help, even if it is said: "a real programmer does not need comments, the code is obvious to him" but sometimes the codes i wrote say a year back is not so understandable, that is why I started to write comments and another reason is because i might work with other people who will edit/write it too.

vizskywalker

Posted 30 October 2005 - 09:25 PM

Also, if you are using XHTML, be sure to read the documentation on how to do comments. In XHTML 1.0 Strict, putting HTML comments around code inside javascript tags is invalid, and will cause lack of validation. Instead, you need to use the CDATA comments.

~Viz

twitch

Posted 29 October 2005 - 07:04 PM

Although a lot of people are against validation, it makes us better at designing. By validating your website and routing out all of the errors, we can make better and more usable sites. Something that XML/XHTML was developed for.

Vujsa, this is a very good thread. However, I believe you failed to mention WHY we put the contents of a script in comment tags. The answer is that older browsers (IE 3.0) may not be able to perform the actions of the script, and would display it as text. By putting it in comment tags, it is kept from displaying, but the browser still reads and processors the script.

h3lium

Posted 10 August 2005 - 07:07 PM

for simple pages, i always find it easier to not use comments, because they usually don't amount to much, but for larger complex projects that involve a lot of coding, commenting is essential for later revisions and modifications

moonwitch

Posted 16 March 2005 - 03:22 AM

You may have noticed that all of my tags use uppercase type.  I have found that this makes picking the tags out from all of the content text much easier.  When I learned HTML, tags were always like this but now validation requires lowercase type as I understand it.  You will have to decide for yourself how best to write your code but I suggest that you keep in mind the possibility that someday you may need to convert your HTML to another markup language.

Tells us about your suggestions for commenting.

Happy coding, :D
vujsa

<{POST_SNAPBACK}>

I used to write my html in uppercase all the time as well, for the same reason you've just touched. To find the actual code easier ;) BUT I've now switched to lowercase, not because of the validation (heh, I hardly ever use it :D) but because xml (and I think XHTML) both require lowercase tags.

My biggest help in writing HTML is basically good indentation. It's one of my pet peeves, to look at horrid code with crappy indentation. For example, someone did write the code in notepad, but prefered "Times New Roman" as font because it looked better than Courier, and they used tab. It will look horrible in code when you do use a fixed width font. I have to admit it, I don't use Courier, but I do use another fixed width font for coding :P (ProggyCleanTT or Anonymous I think)

Anyhow, good tutorial vujsa!

ChronicLoser

Posted 16 March 2005 - 12:42 AM

hmm...i agree that comments are useful in html...but I think it's much more important in scripting (example: java, javascript, php, etc, etc). With html, it usually doesn't get so convoluted to a point where you absolutely need/require comments and such...

but I completely agree with you, vujsa. Comments do make things simpler ^_^

Review the complete topic (launches new window)