Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
HTML for Modification Creators
cheat-master30's Avatar
cheat-master30
Join Date: Mar 2007
Posts: 1,715

Favourite Quotes: In the last moments of the finale of the finale when relief leads to neglience that begets rashness... That is when the comeback that faltered comes back and beats you - Fawful

Information Classified
Show Printable Version Email this Page Subscription
cheat-master30 cheat-master30 is offline 01-09-2009, 10:00 PM

Now, call me a real obsessive for valid code on my site, but just now, I just went and changed practically three people's entire modifications in terms of their coding to fix lazy design practices and to make the site pass validation (or in this case, the logged in view nearly pass validation). But never the less, the reason I'm here and writing this, other than because I like writing articles, is because I'm tired of the 1996 era coding practices of many of the coders and designers here. Now, we all know how greatly important good PHP code is, correct? Well this article will teach you how to not completely try to downplay the importance of the HTML coder the forum and modifications are based on, and how to make the actual code the browser itself sees generally pass validation and to stay clear of decades old crappy coding practices still being used in quite a few released products here.

So What Needs to Change

In my opinion, this is the effort given to the actual HTML and CSS coding in modifications. Way, way too many mods and hacks nowadays seem to go with an idea that 'if it works, it works' without caring less how it's actually coded HTML wise, and meaning those forums that install tons of addons end up with HTML validation errors like crazy and causing all manner of grief to those admins who actually care how their site is coded. Those old web design books teaching about frames and animated gifs are not exactly teaching modern web design or coding in any real sense. We are not in the 90s any more, valid code is important, and Internet Explorer isn't the only browser.

First Things First, ALWAYS Remember the Alt Attribute


Big mistake number one I've seen in a lot of modifications, the alt attribute for images is NOT optional. If the image has no meaning, then you're generally recommended to use alt="" instead of just leaving it out altogether. But in general, try to make sure every single image tag you use in your product or modification has an alt tag with something relevant in said space, both for the blind and screen readers, and various search engine bots and what like.

Way too many mods seem to forget this minor thing, so don't make the same mistake.

Secondly, Encode Special Characters in URLS

You know the drill. Don't just use ampersands in links, like &, use & when using these variables in links. Best of all, don't leave them out AND hard code the links in the PHP files, that's rather annoying to fix when it would take only a few seconds to add that extra section of the code to your links.

Use /> instead of > Where Relevant

This means at the end of all image, link, meta and various other tags. No excuses. Okay, so there is an excuse if you've set the Doctype to HTML 4, but vBulletin is set to XHTML 1.0 Transitional by default, so be nice to the majority of users who aren't going to change the doctype for your modification and use /> where relevant.

Important Note: Where relevant being the key word. Don't use it where it's not needed, such as replacing the </a> in an A tag, like I've seen before and like what probably cause the W3C validation process to nearly choke on the code.

Don't use Mixed Capitalisation for Javascript attributes

In HTML of yore, you'd use OnMouseOver and what not. In XHTML, you use onmouseover and onchange rather than capitalising certain words of these attributes. Doesn't make a difference as far as the javascript itself working, but will cause a few errors when the page is validated and what not.

1996 Deprecated Tags Are to be Avoided

In other words, cut out the embed tags, center tags, font tags and various others like them from your modifications, as they are deprecated and will not be valid in various versions of HTML and XHTML in the future.

Similarly, although they have been considered for future versions of XHTML and what not, please, for the love of everyone's sanity, avoid marquee and blink tags. This is very much because they are annoying as heck, pretty much drive off quite a few visitors and more importantly than not... well, they're just annoying and unusable, okay?

Note: I'm not joking about the marquee attributes in future W3C guidelines:

http://www.w3.org/TR/css3-marquee/#the-marquee-style

Titles and SEO

Now, not quite a HTML issue, I can accept that, but as I said a few months ago, a lot of modification authors need to realise that the title tag has to be used wisely. In fact, a few things to consider are:
  1. You should NOT put your modification name as the title, it's completely useless to search engine bots and visitors, or to their bookmarks.
  2. You should NOT just repeat the website title (*cough* ibPArcade *cough*)
  3. Numerical IDs as title aren't a good idea either.
This section of the page should ideally state the content contained within's title (a picture in a gallery, a game in an arcade, a video in a video directory, an article in an article mod, etc) and maybe, just maybe, some kind of key words that the user entered, maybe from the tags or description.

So there you have it, cheat-master30's not so exclusive guide to proper HTML usage for modification authors, hopefully aimed to stem the tide of badly coded modifications misusing no manner of HTML tags and to get them to use proper CSS. Original article found here:

http://dsultimate.net/Board/upload/blog.php?b=528
Reply With Quote
  #2  
Old 01-12-2009, 06:12 PM
Golzarion's Avatar
Golzarion Golzarion is offline
 
Join Date: Jan 2008
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent.Thanks.
Reply With Quote
  #3  
Old 01-12-2009, 09:20 PM
cheat-master30's Avatar
cheat-master30 cheat-master30 is offline
 
Join Date: Mar 2007
Location: Information Classified
Posts: 1,715
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problem. Hope it helps someone, and I hope more modifications use more up to date coding practices in the future.
Reply With Quote
  #4  
Old 03-01-2009, 03:22 PM
Bilderback's Avatar
Bilderback Bilderback is offline
 
Join Date: Sep 2007
Location: Illinois
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the great article. I've lately been wrestling with XHTML 1.0 Strict on a Drupal site of mine.(very fun)
Another big problem I see alot of people do is improperly use the HTML commenting.
<!-- This is a comment -->

But often, you will find ugly variations of commenting in many peoples code.
<!------------ This is NOT a comment ------------>

<!------------------------------------------------
--------------- Even worse, people ---------------
------------------------------------------------->

A single extra hyphen can cause problems especially dealing with other template engines.
<!--- Just one extra hyhen will throw off vaildation --->
Reply With Quote
  #5  
Old 03-01-2009, 04:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very true!!! From here - http://htmlhelp.com/reference/wilbur/misc/comment.html

Quote:
An HTML comment begins with "<!--", ends with "-->" and does not contain "--" or ">" anywhere in the comment.
Reply With Quote
  #6  
Old 03-01-2009, 08:29 PM
cheat-master30's Avatar
cheat-master30 cheat-master30 is offline
 
Join Date: Mar 2007
Location: Information Classified
Posts: 1,715
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree with the above two posts, those comment types are bad coding, and I'm pretty sure I even read a few articles online before saying what was wrong with them. As said by the posters above, make sure to use proper commenting if you use it.
Reply With Quote
  #7  
Old 08-30-2009, 10:26 PM
cheat-master30's Avatar
cheat-master30 cheat-master30 is offline
 
Join Date: Mar 2007
Location: Information Classified
Posts: 1,715
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need to revive this, because too many modification authors are forgetting all about the ampersand encoding bit. Fix this please, it's annoying having to make your modifications validate, and I don't know enough about PHP to go any further.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:55 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04135 seconds
  • Memory Usage 2,253KB
  • Queries Executed 22 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (6)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete