tao's blog

Speaking at OSCMS Summit

Wow, the schedule for the DrupalCon Sunnyvale is out, and it looks like I am in the Big Room, in the slot between Jeff Eaton and Steven Wittens. Boy, no pressure there. I guess the intersection between Drupal and Ajax is on a lot of peoples' minds right now.

hook_init and require_once

I have been having some trouble figuring out the proper way in 4.7 to break my huge module up into submodules. I have a module that defines multiple node types, so I pulled each node type out into a seperate .inc file. Back in the 4.6 days, I just included them directly into the main module

= drupal_get_path ( 'module' , 'main' );
if (
file_exists ( "$module_path/main.module" )) {
"$module_path/sub1.inc" ;

Upgrading OG to 5.x

Important Organic Groups tip: when you are upgrading from 4.7 to 5.x, be sure to disable og from the organic groups settings page, then turn off the og module, before you do your upgrade. Upgrade, then turn on og and upgrade it, then re-enable it. Otherwise all your groups might wind up empty of content.

AHAH Forms Framework released as a module

I just release the work I have been doing as and official Drupal module, calling it (slightly over-dramatically) the AHAH Forms Framework (http://drupal.org/project/ahah_forms - give it a couple of hours to show up). It's still rough, but the exciting thing is that it does it's magic in less than 100 lines of javascript and 30 lines of php. Really, it is just a small addition to the existing Drupal infrastructure, but it is in the sweet spot of allowing for some really nice advances for not much work.

Eclipse and Module Management - Almost there

Eclipse is a solid tool for creating Drupal modules, but I haven't figured out anyway to use it to create releases. Eclipse comes with a CVS plug in that allows you to checkout the contributions/modules, add your new module and commit it all, no problem. But when it comes time to branch your release(as described here: http://drupal.org/node/17570), simply trying to do: "cvs tag -b DRUPAL-5 modules/mymodule" seems to be impossible. Eclipse is not willing to branch with out also tagging the version you are branching from, and the Drupal contrib release system rejects these verison tags.

AHAH goes to the polls

In response to my AHAH tutorial on groups.drupal.org, Moshe asked if that module could be used to make the poll module dynamic (http://groups.drupal.org/node/2747#comment-7670). I said "not exactly", but it go me thinking, and that lead me to create the beginnings of an ahah framework. To test it out, I just modified poll.module to use the framework. It went pretty quick. The hardest part was getting the form to by dynamic with full page refreshes (and most of that time was stripping out the multiple fields per form code from my example).

Mysqldump and Unicode

I have been having a persistant problem with unicode getting munched when I upgraded my sites. Turns out I have been messing up when I copy my old db. I should be doing:

mysqldump -h host -u user -ppassword --default-character-set=utf8 old_db > db.mysql

mysql -h host -u user -ppassword --default-character-set=utf8 new_db < db.mysql

Towards an AHAH framework / automatic javascript generation

I have been having some really exciting ideas about getting the formAPI to generate the bindings to the javascript. I realized that all the javascript I wrote for the tutorial module could be generalized. Then with a bit of glue code, all of the parameters needed to do the event binding could be put in a properties set on the form element. This way Drupal coders could create modules with sophisticated AHAH effects without needing to write any Javascript at all. Here is an example of a button declaration with all of the info needed to do a incremental page update:

A dynamically expanding AJAX/AHAH Drupal form element.

_*Update*: I stand by most of the information in this article, but I have learned a couple of things in the last two month. I now recommend against pulling information directly out of $_POST or using form_builder. My Ahah Forms package can make a lot of this easier. Please checkout Secure Dynamic Forms and Subforms , Ahah_forms reloaded , and the examples in the Ahah Forms package._

To create a form widget that consists of an unlimited number of subwidgets, expands without needed a full page refresh, and can be easily added multiple times into any Drupal form.

Use hook_element to define the element, hook_nodeapi to handle the db interactions, and jQuery-based AHAH code to do the incremental page updates ( AHAH – Asynchronous HTTP And HTML , not AJAX b/c there is not XML involved, and people seem to think AJAH isn’t sexy enough).

Setting up Eclipse PDT and XDebug

Update (since a lot of people still seem to be coming to this page): The latest version of PDT is 1.0.2, which works with Eclipse 3.3, and it is excellent. The Xdebug plugin is now part of the core package, and the instructions on how to use it are part of the standard help.

I decide to move into the word of real-time debugging today. I have been using the PHPEclipse plug in, but I could not find a 5.1.4 version of the debugger it uses. Fortunately, I was able to get the eclipse PDT (formally PhpIDE) working with XDebug.

Syndicate content