Archive for March 22nd, 2007

Tidy Web Service

March 22nd, 2007

Tidy has become an essential tool for our validation efforts at the University of Nebraska-Lincoln. A co-worker of mine, Alvin Woon, has been tasked with maintaining an unbelievable amount of legacy html, and on top of it tasked with getting it all to validate by May 1st. EEK!

Alvin is my favorite user interface designer, and jazzes up all my ugly server side php code – so having him free to work with me is pretty important, and I’ll do anything I can to keep him happy. Which leads me to my latest pet project at UNL.

We have a set of xhtml templates, which provides a set of code for developers across campus to place content into. For Alvin’s sites, he is on a server which has no server side scripting – so every page is a flat .shtml file.

For Alvin, I created a little script which checks all his pages for validity using Services_W3C_HTMLValidator and if they don’t pass it runs Tidy on the page to do some cleanup and returns the content in a shiny new UNL web page.

The process is fairly simple, and just pulls together bits and pieces I’ve built over the last year or two — the one exception being Tidy.

We have the blessing of using Mac’s in our office which are amazing systems and I’ve grown to love them for productive development machines. A sad side-effect is PHP takes some special work to get it to compile, which Marc Liyanage has thankfully taken care of for all of us lemmings. Unfortunately, all his build scripts have been taken down temporarily for performance.

So, in short — I was left needing Tidy bindings for PHP 5, and no build from source scripts. :-( This left me searching for a Tidy web service, and not having found any I built my own in about 80 lines of code, with a suitable web interface.

here’s the code — http://svn.saltybeagle.com/filedetails.php?repname=saltybeagle&path=%2FTidyWebService%2Findex.php