View Full Version : Validate, Validate, Validate
Owlcroft
Apr 12th 2004, 8:49 pm
Sometimes the oldest, most basic things are the things we need to be reminded about.
I try to be punctilious about keeping the HTML of each page of my site clean and neat and, above all, conformant to standard (currently XHTML 1.0 Transitional). But, having been tripped up the other day (Hans noticed a glaring defect), I finally made myself a little php tool to submit each of my pages to the W3C validator and report back any nonconforming ones. I expected one or maybe two problems.
Wow! Not only almost a dozen regular pages, but also a huge block, over a thousand, that are remade nightly, had defects (that block had a silly error in the code that makes them).
The lesson is, of course, that you cannot validate too often. Time and again, I at least make this or that "utterly trivial" change to some page, only to later find I made a silly typo, or overlooked a bare ampersand in a link, and became nonconformant.
No more, now. From here on, validation is every page, every night.
nlopes
Apr 13th 2004, 3:59 am
Don't forget that PHP has now a new extension: Tidy
This extension allows you to repair the html on-the-fly using a ini configuration setting.
more info at: http://php.net/ref.tidy (written by me :)
misohoni
Apr 13th 2004, 8:53 am
Is keeping it "tidy" all it's cracked up to be? I've spent many years designing sites for Government and we had to stick to Gov Guidelines which were linked to W3C.
Anyway, to cut to the chase - we spent all our time making sure all our pages were compatible with all browsers and keeping it tidy when we forgot to focus on what counted - the page design. If the page layout is bad then no one is going to go back - sorry to say, but look is everything on a web site.
If you keep on conforming to these regulations then your pages are going to be bland!
My point is to actually break away from neat HTML coding and design sites which are useable (not from the browser type point of view) and are clear and interesting to look at...
hulkster
Apr 13th 2004, 8:59 pm
FYI FWIW: I use the Tidy plug-in for vim and like it a lot.
On the other hand, there probably aren't a lotta people using vim to create their HTML! ;-)
Kudo's nlopes for your contribution.
alek
P.S. While I think most browsers/search engines are lenient enough to take non-standard HTML, using Tidy has caught all sort of little errors that would make a difference in the displayed output and saved me the hassle of tracking down what the heck I forgot to put in there.
dazzlindonna
May 15th 2004, 1:31 pm
I have some old sites that I've never gotten around to cleaning up, but I always try to remember to validate new sites that I do. In most cases, it's probably not essential, but it's one little extra step that might ensure all the hard work you put into a site doesn't get wasted - either because a user's browser mangles it up - or because the search engines can't index it.
greg
May 15th 2004, 2:08 pm
the vast majority of pages do not validate, I think webmasters honestly do not care, and really have no reason to. My feeling is if it looks right on all browswers without problems then it is good.
Some of my sites do validate though, I just happen to check my main site the other day after a post in another forum and my site validated. But like i said, the vast majority do not.
nlopes
May 16th 2004, 2:28 am
You may use PHP and Tidy to automatically check&repair on-the-fly.
Just install the Tidy module (in PHP 5 is bundled) and then activate this feature in a .htaccess file, for example:
php_flag tidy.clean_output on
-or in a PHP script-
<? ob_start('ob_tidyhandler'); ?>
<bogus>html.....</p>
Sly
May 18th 2004, 12:57 am
I'm just getting started with PHP... any chance of a copy of your code?
nlopes
May 18th 2004, 6:09 am
I'm just getting started with PHP... any chance of a copy of your code?
What code? The code to automaticaly clean up pages on-the-fly?
It's just:
<?php ob_start('ob_tidyhandler'); ?>
You need the Tidy extension compiled. It is bundled by default in PHP 5. In PHP 4 you must get it throught PEAR. From the manual:
Tidy is currently available for PHP 4.3.x and PHP 5 as a PECL extension from http://pecl.php.net/package/tidy.
Note: Tidy 1.0 is just for PHP 4.3.x, while Tidy 2.0 is just for PHP 5.
If PEAR is available on your *nix-like system you can use the pear installer to install the tidy extension, by the following command: pear -v install tidy.
You can always download the tar.gz package and install tidy by hand: Example 1. tidy install by hand in PHP 4.3.x
gunzip tidy-xxx.tgz
tar -xvf tidy-xxx.tar
cd tidy-xxx
phpize
./configure && make && make install
Windows users can download the extension dll php_tidy.dll from http://snaps.php.net/win32/PECL_STABLE/.
In PHP 5 you need only to compile using the --with-tidy option.
http://php.net/manual/en/ref.tidy.php
Sly
May 18th 2004, 3:19 pm
Thanks for that complete answer to my incomplete question !
disgust
Jun 1st 2004, 9:13 pm
wow, tidy looks interesting..
ResaleBroker
Jul 14th 2004, 10:41 am
the vast majority of pages do not validate, I think webmasters honestly do not care, and really have no reason to. My feeling is if it looks right on all browswers without problems then it is good.
Some of my sites do validate though, I just happen to check my main site the other day after a post in another forum and my site validated. But like i said, the vast majority do not.
When I first started building my site I built a template that I checked in Netscape, Opera and Explorer browsers. After a few tweaks everything looked fine however I know the pages don't validate.
Is there any good reason why I should go back and change those pages? :confused:
Owlcroft
Jul 15th 2004, 12:26 am
When I first started building my site I built a template that I checked in Netscape, Opera and Explorer browsers. After a few tweaks everything looked fine however I know the pages don't validate.
Is there any good reason why I should go back and change those pages?
XHTML
Soon or late, we'll all have to be doing XHTML, and XHTML 2 will be a monstrous conversion for those not already using XHTML 1, and XHTML 1 will be a pain in the butt for those with lots of non-validating code.
Validation doesn't mean you washed your face and said your prayers: it means your code is clean and self-sufficient--you are not relying on the cleverness of browser designers to have anticipated every eff-up you could have made and have built in tolerance for it.
ResaleBroker
Jul 15th 2004, 1:12 am
I can get behind that. I'm not going to rush out and change any of the old pages but I'm not going to continue publishing non conforming pages either.
Lever
Jul 15th 2004, 1:44 am
If you keep on conforming to these regulations then your pages are going to be bland!
Fair point, but is csszengarden (http://www.csszengarden.com) (and it's myriad versions) bland? It validates, it seems to be conforming... :cool:
nlopes
Jul 15th 2004, 3:28 am
XHTML
Soon or late, we'll all have to be doing XHTML, and XHTML 2 will be a monstrous conversion for those not already using XHTML 1, and XHTML 1 will be a pain in the butt for those with lots of non-validating code.
<PUB>
One more time, I have to say that tidy automatically converts HTML to XHTML :)
</PUB>
Owlcroft
Jul 15th 2004, 8:07 pm
Sorry, it may well work wondrous well, but I am always deeply skeptical of things that do lengthy, complex tasks "automatically". Mais chacun a son gout . . . .
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.