Drupal
Rocking Development with Komodo Edit
Submitted by dale on December 2, 2009 - 10:52am
Finding 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. In his presentation Jeff presented a buffet of features that can make you faster in Komodo Edit (and in most cases, the Komodo IDE). Jeff made his presentation slides available and there's a full video of his presentation at the PNWDS site: Hacking Komodo for Drupal development.
Here are some quick notes from Jeff's presentation. They don't cover everything, but do include things like enabling jQuery autocomplete, handy extensions you can install, and running command line scripts from inside Komodo.
Configuration
Make sure you have PHP configured, or you won't get PHP autocomplete

Create a Komodo project file in your top level Drupal directory to get autocomplete on Drupal functions OR Add the Drupal system directories using the library includes feature.
If you're using jQuery, you can enable jQuery function autocomplete using the API Catalogs jQuery Javascript library.

Drupal 7 APIs: A Mindset Change for Scalability
Submitted by dale on October 5, 2009 - 9:57amIn 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.
Drupal 7 APIs: A Mindset Change for Scalability
This video can also be viewed directly at: Drupal 7 APIs: A Mindset Change for Scalability
Vancouver Mozilla Service Week (2009)
Submitted by dale on September 23, 2009 - 12:15pmLast 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. I suspect Roland's short time there has already raised their community profile by a number of hundreds of percent.
The event was primarily Drupal focused, but all topics were welcome. As luck would have it, there was a excellent mix of technical resources and people with questions. It was a wonderful mix of round table, Q & A, and birds-of-a-feather.

Half of the Vancouver Participants (Wish I had wide angle)
A very big thank you and props to Agentic's Darko Hrgovic and Phillip Djwa for an excellent job hosting and facilitating. And a big thank you to Roland for organizing.
Drupal 6 RSS Omnibus
Submitted by dale on July 27, 2009 - 12:11pmDrupal 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

- 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".

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
Submitted by dale on April 28, 2009 - 3:30pm
Freebase 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. This post contains some research results, in the form of PHP code, on integrating Freebase and Drupal.
This code is intended as a proof-of-concept example and jumping off point for other developers. It is not intended as an example of production-ready code.
If you have feedback or a better method, please leave a comment!
Freebase Background
Those of you familiar with Freebase can skip this part. If not, read on!
Freebase uses the Metaweb database. The Metaweb database is not a row/column style relational database, data is organized as an object graph. Documentation on Metaweb architecture is available at the Freebase reference guide: Chapter 2. Metaweb Architecture.
The language used to query Freebase is the Metaweb Query Language, MQL. MQL queries are written in JSON, and are nothing like SQL. The Metaweb documentation page, Freebase MQL Reference Guide, has details and examples of creating JSON MQL queries for reading and writing data.
Mack Hardy: Geo-Location in Drupal 6
Submitted by dale on March 30, 2009 - 11:12amPutting 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!
In a presentation to the Vancouver League of Drupaliers (Vancouver's Drupal user group), Affinity Bridge founder Mack Hardy gave an overview of locative and geo-related modules in Drupal 6. Here is a video of that presentation.
Geo-Location in Drupal 6
This video can also be viewed directly at: Geo-Location in Drupal 6 by Mack Hardy
Hierarchical Listings in Views 2: Replicating the LinksDB Directory
Submitted by dale on March 27, 2009 - 4:54pmThe 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.
This post is part 2 of 2 of how I migrated the CIPS Vancouver Security SIG Links Directory page from LinksDB to CCK/Views. In part 1, Migrating LinksDB Module Data to CCK, I covered migrating LinksDB data into Drupal nodes and taxonomy. In this post I cover creating the URL Links directory page in Views.
Even if you're not interested in LinksDB, this post provides an example of theming Views to display a hierarchical list using taxonomy to define the hierarchy. This same technique was used to render my Drupal Notes page.
Here are before and after screen shots of the SecSIG Links Directory page:
LinksDB Module Page

Views Replacement of LinksDB Module Page

View Definition
The View definition is un-extraordinary. Here is a snapshot of its edit page, an export of it is included at end of this article.
Migrating LinksDB Module Data to CCK
Submitted by dale on March 25, 2009 - 2:50pm
The LinksDB module provides a nice "it just works" way for implementing a classic Links or Resources 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.
This post is part 1 of 2 of how I migrated the CIPS Vancouver Security SIG Links Directory page from LinksDB to CCK/Views. It covers migrating LinksDB data into Drupal nodes. Creating a hierarchical display with Views is covered in part 2.
Creating a CCK node to replace the LinksDB URL entry is trivial. The two areas requiring work are migrating the data in the LinksDB database tables to standard Drupal data objects (CCK and Taxonomy), and creating a hierarchical listing of the URLs in Views.
Even if you're not interested in LinksDB, this post provides an example of programmatically importing data into Drupal using a command line script.
LinksDB also provides some user-facing tools for suggesting links, counting outgoing link clicks, and flagging dead links. Due to spam the suggestion tool was turned off; users have been savvy enough to use the contact form for suggesting links. The tool for flagging dead links didn't prove that useful and the tool for counting outgoing links was never used. These tools were therefore not re-created.
The CCK Node
The 4 fields defining a link entry are: name, URL, description, and category. Here's how I defined them in CCK.
Drupal Command Line Script Template
Submitted by dale on March 23, 2009 - 10:09amThere are development tasks better suited to running in a command-line script than in the Drupal web interface. The two most notable in my experience are code fragment testing, especially when exploring how an API works, and data import/export. Happily, this kind of scripting is possible with Drupal.
The PHP code shown below, created from examples seen in Planet Drupal posts, and later in the drush module, is serving me well as a command-line script template. It works in both Drupal 5 and 6.
Script Template
<?php
$stdout = fopen('php://stdout', 'w');
fwrite($stdout, "Script Template\n");
// Site specific variables
$username = "Dale";
$drupal_base_url = parse_url('http://www.example.com');
$_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
$_SERVER['PHP_SELF'] = $drupal_base_url['path'].'/index.php';
$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
$_SERVER['REMOTE_ADDR'] = NULL;
$_SERVER['REQUEST_METHOD'] = NULL;
require_once 'includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
$user = user_load(array('name' => $username));
//
//
// Drupal code here
//
//
?>Usage Notes
Rick Vugteveen: Building a Blog in Drupal
Submitted by dale on March 16, 2009 - 6:09pmMost experienced Drupal developers don't give a second thought to creating blogs, but if you're just starting out an overview is usually welcome. That's just what Rick Vugteveen from ImageX Media delivered in his presentation, Building a Blog in Drupal: When, Why and How, at the February 2009 meeting of the Vancouver League of Drupaliers (Vancouver's Drupal user group).
The slides from Rick's presentation are available at his website, rickvug.com, in the post: "Building a Better Blog With Drupal" Slides Are Up.
Building a Better Blog With Drupal
This video can also be viewed directly at: Building a Better Blog With Drupal by Rick Vugteveen
