PHP Ain’t So Bad, and Paula’s New Homepage

Paula wanted to update her website last month, so I actually spent some money buying a photographer’s WordPress scheme — what a waste. There were no docs, and the implementation was as unintuitive as I could imagine, so I hand-coded her site single-page JS application.

I finally gave up on MooTools and used jQuery for DOM manipulation, and wrote the rest as a collection of ‘pure JS’ classes — slideshow, portfolio, news section, very straight-forward, and quite good fun.

One Interesting Thing

Paula’s quite good with the machine, but doesn’t like fiddling, so I wanted an easy way for her to upload and manage her images.

The simplest I could come up with was for her to title them in a human-readable, sensible manner, and produce 200px thumbnails with the same title, plus a suffix of ‘_thumb.’ She then FTPs the lot into a directory on the host, and adds a single empty div to the single HTML page of the app — specifying the images’ directory URI in a ‘data-‘ attribute.  Apache’s mod_autoindex directory index is then requested, parsed, and used to generate the portfolios and slideshows.

I’m very pleased with this simplicity.

The Other Interesting Thing

The other interesting thing was that I found it took only two hours to turn this code into a WordPress plugin, and that WordPress can be made to work with OO PHP — great news, considering how much PHP work there is out there. It is almost as ugly as Perl, and nowhere near as sweet as JavaScript can be, but still…