SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)

    HTML formatting script

    Hello,

    Does anyone know of a good HTML formatting script that will turn

    Code HTML4Strict:
    <html><head><title>example</title></head><body><h1>Anyone?</h1></body></html>
    into:

    Code HTML4Strict:
    <html>
      <head>
        <title>example</title>
      </head>
      <body>
        <h1>Anyone?</h1>
      </body>
    </html>

  2. #2
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    There is an extension for Firefox which I sometimes use called "HTML Validator" which has an option to "cleanup this page" which does what you are asking plus a lot more. It also checks your page for errors

    http://users.skynet.be/mgueury/mozilla/

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,122
    Mentioned
    29 Post(s)
    Tagged
    2 Thread(s)
    Thanks Cronikeys,

    I'm actually looking for a PHP script that will format a string like a well formatted html document,

    It's so I can.. say
    • go through a list of files
    • read the file into a string
    • format
    • write file back to server

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    PHP5 can be compiled with HTMLTidy www.php.net/tidy

    This can format your output, as the FF extension does.

    If you want your scripts to be formatted nicely then look for a code beautifier.

    http://www.tote-taste.de/X-Project/beautify/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •