Rotates.org

March 27, 2009 - Ooh, pretty

Just thought I’d share a little trick I’ve just discovered while anally going through a couple of my projects making all the HTML properly indented… it seems I spend a lot of my time trying to find ways to make my life in some way easier, and this is one of the ones which worked!

ob_start();

// your code here

$pretty = new DOMDocument("1.0");
$pretty->preserveWhiteSpace = false;
$pretty->loadXML(ob_get_clean());
$pretty->formatOutput = true;
echo $pretty->saveXML();

Essentially it formats your XHTML (you’d have to use Tidy for regular HTML, but we don’t like that dirty stuff) correctly via PHP’s own XML and DOM manipulation classes. Very nifty – though of course it adds a bit of overhead, and makes everything much less forgiving as far as not well-formedness goes, but hey – I consider that an incentive to write better code 🙂

0 | PHP

March 17, 2009 - ColorShift initial release

As promised, I’ve added the slightly fettled version of ColorShift (as it’s now known – yes I’m English, no I won’t spell it ‘colour’ because I’m a webdev) to the site. Currently it’s in a pretty sorry state and only just works via the crutches of pure hackery that keep it standing…

… okay a bit melodramatic but you get the gist. Go get it!

March 16, 2009 - Acid rain

Appropriately, I’ve decided to add some Flash to the header (which is likely to become more and more resource intensive as I meddle inexorably with its source) which is also appropriately melded in with CSS and Javascript via the nifty new colour changer…

Yes that’s right, you can now change the colour of my blog! Far be it for me as a designer to impose my will upon you and make you put up with my dodgy colours – choose your own dodgy colours instead!*

I’ll include the jQuery (and jQueryUI) source for the colour changer soon when I’ve cleaned up the selectors and made them a bit more portable.

* For the love of god, don’t make it pink though.