Headless Drupal Revisited: Programmatic Manipulation of CCK Defined Nodes

March 13, 2009 | 2 comments

In my previous Headless Drupal post, I proposed ways to work with Drupal content programmatically, particularly for bulk tasks like updating many nodes.

But, in that post, I conveniently only covered plain vanilla Drupal nodes; what if the nodes you need to work with have CCK (Content Construction Kit module) defined fields? These are specified through Drupal’s administrative GUI, and so, its not obvious how to programmatically reference them.

This post will show you the way that I commonly deal with this situation, and I’m embarassed to say, it relies more on knowing a few Drupal tricks than any deep knowledge of the inner workings of Drupal. But these methods easily and reliably show you how to programmatically reference, access and change CCK defined fields just like any other node attribute.

Migrating Nodes and Taxonomies, as well as CCK and Views Definitions, Between Drupal Instances

March 6, 2009 | 1 comment

In my previous Headless Drupal post, I proposed ways to work with Drupal content programmatically, particularly for bulk tasks like updating many nodes.

A question was raised in a comment on that post as to how to use that information to migrate content between instances of Drupal, and in particular how to handle file attachments on nodes, especially if they are large.

I have to admit that I haven’t had to solve this exact problem often, and when I did in the past, it was with basic page nodes. My initial reaction is that the techniques explored in my Headless Drupal post may not be the best fit for this task. I view this task as a basic import/export problem, and from my past experience, I know of contributed modules that specifically address this need, so I decided to reacquaint myself with them in an effort to provide a set of options for solving similar problems.