Drupal in the Deep
The Hungarian Wesnoth Community page was the first site, where I used Drupal. And it remains the first according to Drupal development too. We have a championship over there, which required some pretty complex moduls. But Drupal is the most logical content management system out there, so I thought anything will go like a breeze. Well, it didn’t.
It may seem that Drupal has less features than Joomla for example, but you only need CCK and Views to unleash the lions. CCK enables to easily click together a new custom content, but it has it’s drawbacks. Mainly that the multiple value fields aren’t handled according to their delta values but according to their content. That means if you have three fields and you want to fill out the second one, you can, but it will be uploaded as the first one, if the first one is empty. And Views falls short on complex conditions. After revealing this errors I decided to build my own modules, which (because I already had like 100 new contents) resulted in double efforts on the same job.
There had to be one form for the registration of players. The players got randomly sorted into groups and matches got established in the groups. I had to display both the groups and matches. The championship lasts only 4 months, after that the pages will be archived, so permanent content types aren’t needed at all. This kind of module went pretty smoothly, it is much better than the former CCK version was, easier to install, easier to maintain.
But the next one, where registered site members can upload their replays, was damn difficult. Here I went for the new content type, because I wanted comments and ratings etc. I needed a custom file upload method, for which the how-to wasn’t easy to find! The Drupal API doesn’t say a word about how you should validate the uploaded file, actually it is a cross solution from other form validations. Pretty hidden if you ask, found on a user blog.
The other nasty trick was the AHAH form rendering. I wanted to make only one form for two basically different tasks. The user chooses the type from a radio button list and than more fields appear according to the choosen value. Drupal has this built-in, but it’s useless. Why? You need to registrate the new fields by yourself through cache_get and cache_set. Which you can find on another user blog. The method described there failed me, but fortunately he mentioned that he got it from the poll module. So I turned to that module and it was faulty too! A seemingly sound but actually corrupted Drupal installation has wasted 4 hours of my work! If the site displays just fine, why can’t the JavaScript core work just fine too? So a reinstall solved all my problems and finally got my shiny custom upload, AHAH form.
Drupal’s node and hook system is incredibly logical. But as you dig deeper the well-planned hooks turn into nasty hacks which you can only figure out by yourself or by googling wild. Now I plan to migrate another site from my custom php functions to a content management system, but I have doubt if I should use Drupal or not. I even have some plans to make a new CMS in haXe. But free time is, as always a big limit…