Drupal

The Examples for Developers Module

An example, like a picture, is worth 1000 words. Until recently Drupal programming examples existed but were spread among documentation pages, blog posts, and the Drupal CVS repository; some searching required. That changed in late 2009 with the introduction of the Examples for Developers module. Its purpose: "to provide high-quality, well-documented API examples for a broad range of Drupal core functionality". Now you can find high-quality, working Drupal 6 and 7 code examples in one place, many with SimpleTests.

Drupal Command Line Scripts with Drush

Drupal's scripting abilities just keep getting better and better. Since publishing my Drupal Command Line Script Template last year I've moved exclusively to the Drush php-script (scr) command. The script template article still gets a lot of page views - perhaps because with all the functionality in Drush it's easy to miss the scripting feature - so posting an update seems like a good idea.

Drush Scripting Advantages/Disadvantages

The advantages of using Drush over using my original template are:

  • Drush takes care of creating the Drupal environment for the script to run in, which is the only function the template served. Using Drush factors out the environment common code, eliminating redundant code in individual scripts.
  • Drush makes it easy to place the script files in a directory outside of the Drupal website home directory. Placing script files outside the website home directory eliminates a whole range of security issues.
  • The Drush code that creates the Drupal environment is reviewed by the community, making it far more robust than something a single person could create or maintain on their own.
  • When the code required to create the Drupal environment changes you don't need to update individual templates, just Drush.

Node Image Gallery with ImageField

ExampleWhen image-sets are discussed it's usually in the context of a full featured photo gallery, but there's another common use: including a set of images with the content of a node. For example, product images with a product node or a "mini" photo album with an article. The CCK ImageField combined with a jQuery module like Thickbox makes adding image-sets to nodes easy. Here's how.

Overview

This "recipe" describes how to add a gallery style photo-set to a node. This photo-set stands apart from the node content as a set of thumbnails which can be clicked on to display the full-size version. The Thickbox slide-show feature is also implemented so viewers are able to step through the full-size version of the pictures without exiting the viewer. Although Thickbox is used, this technique should be easily adoptable to different plug-ins.

An example of the technique can be seen here: Finding the Blue Whale

Rocking Development with Komodo Edit

Komodo LogoFinding the time to really learn the tools we use can be difficult, but sometimes opportunity breaks the door down. This was the case at the Pacific Northwest Drupal Summit with Jeff Griffith's presentation Hacking Komodo for Drupal Development.

Drupal 7 APIs: A Mindset Change for Scalability

In a presentation at the September 2009 meeting of the Vancouver League of Drupaliers (Vancouver's Drupal user group) core Drupal Developer and Now Public Development Team Lead Károly "CHX" Négyesi spoke about the importance of APIs in Drupal 7. If you're serious about scalability APIs are no longer an optional convenience. For some this may not be an issue, for others this could be a mindset change. Károly also discussed some other Drupal 7 improvements like functional testing.

This is a video of his presentation.

Vancouver Mozilla Service Week (2009)

Last week was Mozilla Service Week and local Mozilla Messaging Technical Support Lead Roland Tanglao organized a Vancouver event at the offices of Agentic. At this point many Drupalistas are probably thinking: Wait a minute, is this the same Roland who used to work at Bryght? Yes, yes it is. And Vancouver readers are probably thinking: Wait a minute, Mozilla has an office in Vancouver? Yes, yes they do.

Drupal 6 RSS Omnibus

Drupal RSS functionality is spread out, and so is information on it. After first accumulating mental notes, which turned into a collection of written notes and code snippets, I realized there's a lot to be said on the topic. A single overview covering all things RSS seemed like a useful idea. This is a starting point covering many things RSS. I invite you to leave a comment if you have anything to add, a great reference or blog post, or if I've gotten something wrong.

"Out of the box" RSS

  • RSS is configured and controlled at Administration > Content management > RSS Publishing
    RSS Publishing Settings
  • The default RSS URL is rss.xml (e.g. www.example.com/rss.xml)
  • The default RSS feed selects content using the same selection criteria as the /node path ("/node" is the default front page setting). It contains the content of any node that's both "Published" and "Promoted to front page".
    Publishing Settings

    The exact content and number of nodes is determined by the RSS settings.
  • There is no provision to theme a node's RSS output in the PHPTemplate theme engine. Your node.tpl.php file is ignored when the feed content is rendered.
  • Because of the above point, double check the RSS feed output of any feed containing nodes you've created or modified with CCK.
  • Every taxonomy term automatically gets a feed (whether you want it or not)
  • The is no provision in the Drupal base installation (core) to publish comments in a RSS feed. A contributed module (RSS Comments or Views) is required. More on this later on.
  • The RSS feed will only be published on the front page. More on this later.

Drupal/Freebase Integration Notes

Freebase and Drupal connectedFreebase is an open database (CC-BY) of world information with a web service interface. Think Wikipedia with an API. I've been playing around Drupal/Freebase integration for a community project we have brewing, Semantic Web Community Barn Raising in Vancouver.

Mack Hardy: Geo-Location in Drupal 6

Putting location data on maps, especially dynamically, used to be a dream. No longer. Thanks to open standards, APIs, Internet based map web services, and many hours of work in the Open Source community, a new wave of options are available for putting location based data on maps. And Drupal is surfing this wave!

Hierarchical Listings in Views 2: Replicating the LinksDB Directory

The LinksDB module provides a nice "it just works" way for implementing a classic Links page. The standout feature is its hierarchical display of the URLs. Even after Views and CCK arrived, the hierarchical display was worth staying with the module. Sadly, with a site to upgrade and no Drupal 6 version of LinksDB in sight, it was time to convert.

Pages

Subscribe to RSS - Drupal