1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Validate, Validate, Validate

Discussion in 'HTML & Website Design' started by Owlcroft, Apr 12, 2004.

  1. #1
    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.
     
    Owlcroft, Apr 12, 2004 IP
  2. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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 :)
     
    nlopes, Apr 13, 2004 IP
  3. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #3
    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...
     
    misohoni, Apr 13, 2004 IP
  4. hulkster

    hulkster Peon

    Messages:
    1,705
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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.
     
    hulkster, Apr 13, 2004 IP
  5. dazzlindonna

    dazzlindonna Peon

    Messages:
    553
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.
     
    dazzlindonna, May 15, 2004 IP
  6. greg

    greg Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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.
     
    greg, May 15, 2004 IP
  7. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    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>
     
    nlopes, May 16, 2004 IP
  8. Sly

    Sly Well-Known Member

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #8
    I'm just getting started with PHP... any chance of a copy of your code?
     
    Sly, May 18, 2004 IP
  9. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    What code? The code to automaticaly clean up pages on-the-fly?
    It's just:
    
    <?php ob_start('ob_tidyhandler'); ?>
    
    PHP:
    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:

    http://php.net/manual/en/ref.tidy.php
     
    nlopes, May 18, 2004 IP
  10. Sly

    Sly Well-Known Member

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #10
    Thanks for that complete answer to my incomplete question !
     
    Sly, May 18, 2004 IP
  11. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #11
    wow, tidy looks interesting..
     
    disgust, Jun 1, 2004 IP
  12. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #12
    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:
     
    ResaleBroker, Jul 14, 2004 IP
  13. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #13
    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.
     
    Owlcroft, Jul 15, 2004 IP
  14. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #14
    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.
     
    ResaleBroker, Jul 15, 2004 IP
  15. Lever

    Lever Deep Thought

    Messages:
    1,823
    Likes Received:
    94
    Best Answers:
    0
    Trophy Points:
    145
    #15
    Fair point, but is csszengarden (and it's myriad versions) bland? It validates, it seems to be conforming... :cool:
     
    Lever, Jul 15, 2004 IP
  16. nlopes

    nlopes Guest

    Messages:
    103
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #16
    <PUB>
    One more time, I have to say that tidy automatically converts HTML to XHTML :)
    </PUB>
     
    nlopes, Jul 15, 2004 IP
  17. Owlcroft

    Owlcroft Peon

    Messages:
    645
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #17
    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 . . . .
     
    Owlcroft, Jul 15, 2004 IP