[PHP] Outputting Valid HTML

Discussion in 'Web Design & Coding' started by vern, Aug 3, 2005.

  1. vern

    vern Dominus Political User Folding Team

    Messages:
    1,571
    Location:
    Minnesota, USA
    Is there a script or function out there that checks and replaces what would otherwise be just plain and possibly not valid HTML into valid HTML?
     
  2. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    easily? no since valid html would depend on which standard you used.

    You could make some nice regular expression checks to make sure each tag has a closing tag and such
     
  3. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    You'd need to include the entire HTML (or XHTML) specification that you're going to be using in a rather large PHP class and check the code for anything which doesn't follow the rules.

    It'd be a rather large job, and I've never come across a script which does it. I'd just stick with the w3 Validator and their HTML Tidy application. Both can be found on http://w3.org/ if I recall.
     
  4. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
  5. vern

    vern Dominus Political User Folding Team

    Messages:
    1,571
    Location:
    Minnesota, USA