Drupal

jQuery UI Accordion in Drupal 6

jQuery UI: It can add some great features to your site, but it is a bit difficult to set up in Drupal 6.jQuery UI: It can add some great features to your site, but it is a bit difficult to set up in Drupal 6.jQuery UI is a collection of jQuery plugins and offers great interface widgets that are easy to use. You probably recognize many of them from websites you've used. The only catch is that they don't work with Drupal version 6 without a few tweaks. I had an idea for using the jQuery UI Accordion widget and I had to figure out how to get it working on my D6 website.

Library conflicts

There is a jQuery UI module for Drupal (http://drupal.org/project/jquery_ui). Since jQuery UI is a third party library, you have to download it and install it in the module directory. Now there are a few snags... The native jQuery library for D6 is 1.2.6. The Drupal jQuery UI module tells you to download the jQuery UI v. 1.6 library which works with jQuery v. 1.2.6. But, the jQuery UI v. 1.6 is no longer available on the site. jQuery UI v. 1.7 is available, but it requires jQuery 1.3. That left me with a choice: find the obsolete library, or upgrade Drupal's native jQuery library. I chose the latter.

Writing a Simple Drupal Module


A while back I had an idea to do a simple Drupal Module to take Environment Canada's weather RSS feed and automatically it to Twitter. I didn't see anything in the Drupal contributed modules, so I decided to write my own. (A proof of concept is running on the website: http://canweather.com.) The logic is quite simple:

  • Read an item from the RSS feed.
  • Record that I have read that item.
  • Process the text to decide whether to post the item, and make any changes (eg. truncate long messages).
  • Post the text to a Twitter account.

Creating a CCK Custom Field

Last week I was updating a CCK custom field from Drupal 5 to Drupal 6. The D6 module updates are pretty simple, the catch is that CCK migrated to version 2 with D6. Unfortunately, the documentation for the CCK API is not as complete as the API documentation for Drupal core.

I got stuck on some of the naming, specifically around formatter functions. There's a blog post by Jennifer Hogdon that really helped sort out all the confusion: http://poplarware.com/articles/cck_field_module

A few other resources

CCK for developers: http://drupal.org/node/101742
CCK hook documentation: http://drupal.org/node/342987
Updating CCK modules from 5.x to 6.x: http://drupal.org/node/191796

Pages

Subscribe to RSS - Drupal