Blog

Chapter 2 code available

Scott's picture

Scott

Apr 04, 2008

I got the annotate example from chapter 2 working with Drupal 6. The code I used is here: http://emma.ojctech.com/~rohde/public/ProDrupalDevelopment/ch2/.

In modifying the code, I've used '#' at the beginning of lines to comment out obsolete code in the books Drupal 5 version, and '###' for my own comments. (Exception: For obvious reasons, I used ';' and ';;;' respectively in the annotate.info file.) Those comments should make it fairly clear what code I've added.

For the most part, my code should be the nearest Drupal-6 equivalent of the code listed in the text. The one thing I'm not yet clear about is how caching works: Where the text had function annotate_menu($may_cache), I have simply function annotate_menu() because the new hook_menu API doesn't seem to allow a parameter. So I simply dropped the if ($may_cache) { ... } wrapper around the bulk of the code inside that method.