Validation

Discussion in 'HTML' started by darren, Jan 5, 2006.

  1. darren

    darren Guest

    Hi Folks,

    What is the best way to validate HTML produced by PHP?

    I have been "viewing source" and copying and pasting into the code
    checker at http://validator.w3.org/

    Cheers
    Darren
    darren, Jan 5, 2006
    #1
    1. Advertising

  2. darren

    Els Guest

    darren wrote:

    > Hi Folks,
    >
    > What is the best way to validate HTML produced by PHP?
    >
    > I have been "viewing source" and copying and pasting into the code
    > checker at http://validator.w3.org/


    Why didn't you just use that validator on the URL?

    --
    Els http://locusmeus.com/
    Sonhos vem. Sonhos vão. O resto é imperfeito.
    - Renato Russo -
    Now playing: Outburst - Attack of the Overfiend
    Els, Jan 5, 2006
    #2
    1. Advertising

  3. darren

    Nico Schuyt Guest

    darren wrote:
    > What is the best way to validate HTML produced by PHP?
    > I have been "viewing source" and copying and pasting into the code
    > checker at http://validator.w3.org/


    That's one solution. The other is to use the URL from the page on a (remote)
    server. AFAIK there's no program that can validate PHP-pages on local host.

    --
    Nico Schuyt
    http://www.nicoschuyt.nl/
    Nico Schuyt, Jan 5, 2006
    #3
  4. darren

    Oli Filth Guest

    Nico Schuyt said the following on 05/01/2006 13:32:
    > darren wrote:
    >
    >>What is the best way to validate HTML produced by PHP?
    >>I have been "viewing source" and copying and pasting into the code
    >>checker at http://validator.w3.org/

    >
    >
    > That's one solution. The other is to use the URL from the page on a (remote)
    > server. AFAIK there's no program that can validate PHP-pages on local host.
    >


    There's always the Tidy/HTML Validation extension for Firefox...

    --
    Oli
    Oli Filth, Jan 5, 2006
    #4
  5. darren

    darren Guest

    Should also have mentioned that the site is a members only site, so the
    validator gets refused entry.
    darren, Jan 5, 2006
    #5
  6. darren

    darren Guest

    Sorry Folks,

    I have been a prize idiot, there is one in Dreamweaver.

    Cheers
    darren, Jan 5, 2006
    #6
  7. darren

    Els Guest

    darren wrote:

    > Should also have mentioned that the site is a members only site, so the
    > validator gets refused entry.


    You can give the validator a password I thought?

    --
    Els http://locusmeus.com/
    Sonhos vem. Sonhos vão. O resto é imperfeito.
    - Renato Russo -
    Now playing: Dirty White Boy - Badlands
    Els, Jan 5, 2006
    #7
  8. darren

    cwdjrxyz Guest

    darren wrote:
    > Hi Folks,
    >
    > What is the best way to validate HTML produced by PHP?
    >
    > I have been "viewing source" and copying and pasting into the code
    > checker at http://validator.w3.org/


    I always use the w3c validator that you mention. If the page validates,
    you also are given the option to validate the CSS if you wish.

    You have to be very careful in validation of a php page, because php
    sometimes is designed to give different results for browsers that
    handle things in different ways. Thus you get different source code on
    different browsers. For example, I am now serving many of my pages as
    xhtml 1.1 using the correct mime type application/xhtml+xml. The recent
    Mozilla family(Firefox,Netscape,Mozilla) and Opera browsers can handle
    the code served with this correct mime type, but IE and some earlier
    browsers can not. Hence I write a php include at the very top of the
    page that sees if the viewing browser will accept true xhtml served
    with the correct mime type. If it can, all of the page above the head
    tag is written in xhtml 1.1 and served with the correct mime type. If
    it can not, the code above the head is written as html 4.01 strict and
    <br /> etc is converted to <br> etc required for xhtml, using regular
    expressions. Also a comment is written in the source code for html 4.01
    saying that the code has been converted to html 4.01 because the
    browser is out of date and can not support true xhtml 1.1 served
    correctly. The php include code also forces the w3c validator, when you
    input a URL, to validate the php page as true xhtml 1.1(the validator
    contacts the php page for validation directly, and not through your
    browser). To validate the source code for the xhtml or html page served
    to your browser, you have to right click while on the page, copy the
    source, and paste it in the text box at the w3c validator. To see an
    example of this, go to my page at
    http://www.cwdjr.info/media/playersRoot.php .If you use a recent
    Mozilla family browser, when you right click and select to show source,
    you will find xhtml 1.1 code. If you use an IE6 browser, you will find
    html 4.01 strict code. In this case it is always important to validate
    the html 4.01 strict code to make certain the automatic php conversion
    from xhtml 1.1 to html 4.01 strict was done properly. If you use the
    extended interface at the validator, it will tell you the mime type
    used to serve the page, and it is application/xhtml+xml if you serve
    xhtml 1.1 correctly. Many write xhtml pages and serve them as html. You
    have to have the correct mime types for xhtml on the server, and you
    use a php approach such as I used if you want to handle IE6 and such,
    or you use a .xhtml or .xml extension(with mime types for these
    installed on the server) if you are only interested in browsers that
    can handle true xhtml.

    ______________________________________________________________________

    Due to increased spam, my new spamtrap1 address is set up only for NGs
    and all mail to it gets dumped into a junk mail folder every day and
    soon is automatically deleted This address will be changed as spam to
    it increases. I try to view the junk mail file every day, but I
    sometimes miss.
    cwdjrxyz, Jan 5, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Colin Mackay
    Replies:
    0
    Views:
    2,668
    Colin Mackay
    Jun 25, 2003
  2. Libs
    Replies:
    0
    Views:
    1,478
  3. Colin Basterfield

    Web form validation vs object validation

    Colin Basterfield, Nov 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    416
    Tommy
    Nov 29, 2003
  4. Matt
    Replies:
    14
    Views:
    4,061
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  5. Lucas Tam
    Replies:
    2
    Views:
    1,088
    Lucas Tam
    Feb 26, 2004
Loading...

Share This Page