Automatic W3C validation?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Baron Samedi

    Automatic W3C validation?

    One of my many, many "started with enthusiasm, then quietly abandoned"
    projects was to code some PHP which could be included into every page
    on my site (blog included) and would verify the page (via the W3C
    validator) each time that it was loaded and e-mail me if there were any
    problems.

    I "quietly abandoned" it when I realized that it was "kewel to kode"
    but I don't really know why I wanted it, or how it would work.

    On the face of it, I only need to validate each time I change a page.
    So, validating with every load seemed ridiculous; which lead me to a
    flat file database where I could check the page file's last update date
    against its last verification date, thus avoiding unnecessary
    validation.

    Then it occurred to me that with so many includes (standard header &
    footer, etc for menu, hit count, etc), the web page's main file could
    be unchanged, but - if an included file were altered - then it might
    no longer validate properly.

    See my dilemma? So I have put this to one side (since there are plenty
    more little projects to code) until I can specify it correctly.

    Any comments/suggestions? Anyone know of something similar which
    already exists?

    Thanks in advance for any fedback.

  • R. Rajesh Jeba Anbiah

    #2
    Re: Automatic W3C validation?

    Baron Samedi wrote:[color=blue]
    > One of my many, many "started with enthusiasm, then quietly abandoned"
    > projects was to code some PHP which could be included into every page
    > on my site (blog included) and would verify the page (via the W3C
    > validator) each time that it was loaded and e-mail me if there were any
    > problems.[/color]
    <snip>[color=blue]
    > Any comments/suggestions? Anyone know of something similar which
    > already exists?[/color]



    --
    <?php echo 'Just another PHP saint'; ?>
    Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

    Comment

    • Faust

      #3
      Re: Automatic W3C validation?


      R. Rajesh Jeba Anbiah wrote:[color=blue]
      > Baron Samedi wrote:[color=green]
      > > One of my many, many "started with enthusiasm, then quietly abandoned"
      > > projects was to code some PHP which could be included into every page
      > > on my site (blog included) and would verify the page (via the W3C
      > > validator) each time that it was loaded and e-mail me if there were any
      > > problems.[/color]
      > <snip>[color=green]
      > > Any comments/suggestions? Anyone know of something similar which
      > > already exists?[/color]
      >
      > http://in.php.net/tidy
      >[/color]

      hi, Raj,

      rather a cryptic comment, don't you think? How is that supposed to
      help?

      Comment

      • R. Rajesh Jeba Anbiah

        #4
        |OT| Re: Automatic W3C validation?

        Faust wrote:[color=blue]
        > R. Rajesh Jeba Anbiah wrote:[color=green]
        > > Baron Samedi wrote:[color=darkred]
        > > > One of my many, many "started with enthusiasm, then quietly abandoned"
        > > > projects was to code some PHP which could be included into every page
        > > > on my site (blog included) and would verify the page (via the W3C
        > > > validator) each time that it was loaded and e-mail me if there were any
        > > > problems.[/color]
        > > <snip>[color=darkred]
        > > > Any comments/suggestions? Anyone know of something similar which
        > > > already exists?[/color]
        > >
        > > http://in.php.net/tidy[/color]
        >
        > hi, Raj,
        >
        > rather a cryptic comment, don't you think? How is that supposed to help?[/color]

        If you have rather followed the link and read the contents, you
        might have realized how helpful it is. I'm personally not for mirroring
        php document in c.l.php. I also prefer not to use sock puppet
        <http://www.answers.com/sock%20puppet> tricks.

        --
        <?php echo 'Just another PHP saint'; ?>
        Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

        Comment

        • Faust

          #5
          Re: |OT| Re: Automatic W3C validation?

          I certainly agree that this is very helpful information. I am just not
          sure how it answers the question.

          Does there already exist some PHP code to invoke the W3C validator
          every time that a page is loaded? Is this even a good idea? (maybe it
          should be done by cron job?)

          Yes, your link is great help for pasring the elements of an HTML page -
          no arguement - it just didn't seem to anwser the question, and just
          posting the link with no indictaion of why it was relevent doesn't seem
          to help.

          But, I don't want to start an argument, so please ignore this if it
          offends you.

          Comment

          • Faust

            #6
            Re: |OT| Re: Automatic W3C validation?

            And sorry for the sock puppet. I just switched google accounts without
            noticing.

            Comment

            • Balazs Wellisch

              #7
              Re: |OT| Re: Automatic W3C validation?


              "Faust" <graham@gmx.net > wrote in message
              news:1136437450 .240944.318050@ g49g2000cwa.goo glegroups.com.. .[color=blue]
              >I certainly agree that this is very helpful information. I am just not
              > sure how it answers the question.[/color]

              If you scroll down a little bit on that page you will find:



              Isn't that what you were asking for? You can use tidy to parse, validate and
              repair any PHP document. (As long as it generates HTML of course.)

              Balazs


              Comment

              • Faust

                #8
                Re: |OT| Re: Automatic W3C validation?

                Wow! You are correct. That will do it. Sorry, Raj, I missed that,
                drowned in information. If you had just added that one sentence it
                would have been most helpful.

                What I didn't bother to mention, because I didn't think that it was
                relevant, was that I have already written code to invoke the W3C
                validator and to parse the result. But I can certainly replace it with
                this. Thanks to both of you.

                Now we have the practical solution of *how* to validate an html page,
                and we come to the philosphical questions of *whether* and *when* to
                validate it.

                Is it a good approach to validate a page each time that it loads?
                Probably not, since this adds overhead, both to the page load and to
                the W3C servers.

                Perhaps each time that it changes? But what if the page doesn't change,
                but some include, or its include does? How to know that?

                Aha! perhaps I can compute a checksum of the dispalyed page and
                validate if that changes. Hmm, no, this is no good on pags with hit
                counters or any other variable content which can change but will never
                break validation?

                Maybe I should just have a cron job to validate my site overnight, or
                once a week and email me if anything does not validate.

                See what I mean? That's the sort of thing that I would like to disucss.
                What do you think?

                Thanks in advance

                Comment

                • Balazs Wellisch

                  #9
                  Re: |OT| Re: Automatic W3C validation?

                  [color=blue]
                  >
                  > Is it a good approach to validate a page each time that it loads?
                  > Probably not, since this adds overhead, both to the page load and to
                  > the W3C servers.[/color]

                  I have not verified this, but I doubt tidy would add a lot of overhead.
                  Especially if you have a caching engine running, like Zend Optimizer. If you
                  run any benchmarks please post the results.

                  Thanks,
                  Balazs


                  Comment

                  • R. Rajesh Jeba Anbiah

                    #10
                    Re: |OT| Re: Automatic W3C validation?

                    Faust wrote:
                    <snip>[color=blue]
                    > Is it a good approach to validate a page each time that it loads?
                    > Probably not, since this adds overhead, both to the page load and to
                    > the W3C servers.[/color]
                    <snip>

                    Tidy is an extension and it won't contact W3C servers. Read the
                    manual closely again. FWIW, check this link too
                    <http://www.zend.com/php5/articles/php5-tidy.php>

                    --
                    <?php echo 'Just another PHP saint'; ?>
                    Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

                    Comment

                    • Baron Samedi

                      #11
                      Re: |OT| Re: Automatic W3C validation?

                      Hmm, "The most fundamental ability of HTML Tidy is its ability to
                      parse, diagnose, clean and repair HTML and XHTML documents". But all
                      of my website are PHP documents, not HTML or XHTML :-(

                      When I ask W3C to validate htttp://mysite.com/index.php, it fetches it
                      from the server, the PHP is executed before it is passed to W3C and
                      what W3C receives is what the user would see in a broswer, which is
                      effctively HTML.

                      However, I think that it would be possible for me to use TIDY to
                      generate my web pages. Hmm, what if I include a PHP script to generate
                      some code and it generates invalid HTML? I can see that I need to look
                      into this further.

                      Comment

                      Working...