cck

Drupal Installation Profile Woes

Most of my work to date has been Drupal 5, but a new project I am involved in has required the switch to Drupal 6. On the whole I couldn't be happier - D6 is really nice in so many areas, and the switch has been pretty painless. Except - I'm now looking at Drupal installation profiles.

A couple of gotchas that I wasn't expecting...

Programmatically Creating Drupal Nodes

Programmatically Creating Drupal Nodes

The Drupal for Developers event was great fun this week. I did a 15 min presentation on Programmatically Creating Drupal Nodes. The slides from this presentation will be going up on the Drupal UK site in the near future, but you can get a preview of the presentation below.

Presentation for Drupal Developers Meeting

Drupal UK Logo

I will be speaking at the next Drupal UK event, which is being held at The Economist offices in London next Wednesday, 30th July.

My presentation is going to be about programmatically creating content (nodes) including CCK fields, attachments, and images. I will be presenting a case study from recent development that automatically creates content from iTunes Producer packages.

Places are limited but you can find more information and signup here:
http://drupal.org.uk/event/drupal-developers/04-jul-2008

Also, check out the other upcoming Drupal UK events, I will also be presenting at the Enterprise event.

Node Reference Autocomplete with Auto-create Drupal node content from Wikipedia

Here's a few bits of code from today's Drupal wranglings that solves a tricky UX problem with Drupal and CCK Node Reference fields.

Ever wanted to deal with the case that a user might want to reference a node that doesn't exist yet? Well I've played around with a couple of modules (Add n Reference and Add Node), but they didn't offer the clean user experience I needed. Here's an example use-case:

Image Resizing with CCK, Imagefields, Imagecache and PHPTemplate

If you have a CCK content type with an image field you get display options that allow you to change the image size on teasers and full node views. First you set up your image presets using the imagecache settings. I usually let users upload at any size, and deal with the resizing as required. Here's how to ensure you get best results from imagecache, and how to embed imagefield images into your PHPtemplates using the theme functions provided by imagecache:

Programmatically Creating CCK Nodes and Adding Images with Imagefield

in

There's a useful post on civicactions that explains how to create nodes in your Drupal site programmatically. I'm using this technique to create an import script for processing bulk quantities of XML files.

There's a facet to the create node process, in that I couldn't get it to import images using the $values[] array.

I found that I could create all the CCK fields by assigning them fields in the $value[] array, but for imagefield values I had to instantiate them in the $node object instead.

Syndicate content