INSTRAW Tech, Take 1: CakePHP

UN INSTRAW researchers have become fond of building databases of their research, for public consumption .. very simple, small, searchable lists of research institutions and documentation and the like. The permanent web dev here, being a very nice and agreeable guy, has allowed the data for these databases to be compiled in Microsoft Word .. which he has dutifully, if not a bit pervertedly ;), processed into SQL INSERTS using a combination of AbiWord, yacc (!!), and Perl.

One of my tasks in taking on part time work here (in exchange for salary, and office space for my own work, in the other-part time .. well you can imagine how that turned out..) was to build one of these databases, for Gender Research Methodology references. Clearly there must be a better way! Even with the perverse call of yacc in my possible web development toolbox.

With only a single table, the most braindead CRUD scaffolding was going to get me 99% of the way there. The Word Documents would be banished (except for one final import for this database .. which became so painful, battling AbiWord’s crummy character encoding translation, that I abondoned the automated import for YES a manual import)! I started looking at Rails obviously, but thought again, this place being by and large a PHP shop, I shouldn’t foist too much new stuff on the place.

Looking around for PHP Frameworks, there were quite a few, like Zend and Symfony .. but CakePHP kept jumping out at me. Maybe I was hungry, or maybe it was the way the logo danced on the CakePHP site. Being called the Rails of PHP was somewhat hopeful, and going through the 15 minute Blog Tutorial sealed the deal. The architecture and conventions were dead on similar to Rails. Sure it didn’t have all the features of Rails, but in a way it felt a little simpler to get around (and maybe not so many panicky bug fixes). PHP still feels comfortable to me.

The resulting application is dead simple — CRUD administration, with a Searchable front end, on a single table. I basically only added a Helper for what I termed a Psuedo-Set — a group of Boolean SQL columns that share the same prefix. I wanted an easy way to display these as a group, and wrote a helper to do so based transparently on model inspection. (If this is of any use to anyone, let me know and I’ll publish it). Also, CakePHP’s builtin TextHelper had slightly buggy autoLinkUrls method, so I wrote my own version.

The next time they need a database app here, it should be possible to be up and running within a day. The INSTRAW Gender Methodologies database may not be that exciting technically, but it’s possibly the first United Nations installed of CakePHP.

I’m pretty impressed with CakePHP. Well done Bakers! And I can say, the folks on #cakephp were incredibly helpful (more helpful than #rubyonrails) and humored my mostly dumb questions. If PHP is your thing, and you don’t want to enter the Ruby world, check out Cake PHP.

INSTRAW Tech Showcase

The summer here in Santo Domingo is wrapping up. There’s been a lot of adventures, and a lot of hard work too. Among many things, I’ve been working part time at UN INSTRAW, filling for the web dev who’s taking some time off. It’s been cool to again work at the United Nations, this time at a much smaller agency .. which has meant more freedom technically and more long term impact, I reckon.

I’ve introduced three major software packages here, and done a fair bit of hacking on each .. MediaWiki, CakePHP, and CiviCRM. I’ll be writing some reviews of how its gone deploying and programming within these great pieces of software, starting off with CakePHP…