Maria’s Guides

Support and additional material for readers of books, articles, and digital media by Maria Langer.


Random Book Cover #1Random Book Cover #2Random Book Cover #3Random Book Cover #4Random Book Cover #5Random Book Cover #6Random Book Cover #7Random Book Cover #8Random Book Cover #9

The Importance of XHTML Validation

Posted on January 28th, 2007 at 1:59 pm ·
Filed in: RSS WordPress Books   

When will I ever learn?

Miraz has told me again and again — validate your pages after making changes to your WordPress theme templates. She even advised readers in our book, WordPress 2: Visual QuickStart Guide. And every time I validate, I find errors, proving that it’s a step I really do need to take.

Yet I continue to skip this step when I tweak my theme’s template files on every single blog I run.

This morning, I got an e-mail message from someone named Tine who wrote:

I’m completely new to Wordpress but found your site because of the book you have made and was curious.

Are you aware that your blog don’t look good in Explorer 6? Some of the text to the left is cut off.

I use Explorer 6 on XP Pro and 1024×768.

Uh-oh.

I fired up my PC and loaded up my home page in Explorer 6. The situation was worse than Tine reported. What appeared did not look much like my site at all. And in the status bar, Explorer was politely telling me that page had errors but didn’t offer any way to find out what they were.

My first instinct was to panic. But then I remembered the XHTML validator at http://validator.w3.org/. I ran the page’s URL through the validator and settled down to find and fix the 110 errors it found.

Sheesh.

The main culprit in this case was some code I’d inserted into my post.php file to display RSS links beside category names in each post’s header. This rather slick piece of coding, which I was pretty proud of, contained the dreaded unencoded ampersand error. That means I’d included & in the code when I should have included & in the code. That error was all over the place, but Explorer seemed to be choking on it in the new code. When I fixed its first occurrence and reloaded the page in Explorer, the page appeared fine, although the status bar smugly reported that there were still errors in the document.

Other problems included <ul> and </ul> tags without <li> and </li> tags. Oops. And <p> tags without </p> tags. (It appears that ecto was causing that problem in the way it codes Technorati tags. Good thing I’m not using tags in my posts anymore.) Of course, all my Amazon.com book cover links were missing alt attributes. And some of my rotating ads used IMG instead of img for coding. The list goes on and on.

Of course, if I’d been validating the XHTML after each template change as Miraz recommends, I would have caught these errors as I introduced them. I wouldn’t have spent my Sunday morning debugging code.

Have I learned my lesson? I think so. At least for a few days.

 • Read 268 Times
Add to Del.icio.usAdd to Del.icio.us • Technorati ThisTechnorati This • Digg ThisDigg This • Stumble ItStumble it! • Twit ThisTwit This


 

 

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

If you have a Gravatar, it will appear beside your approved comment.
No Gravatar? Get one free!