Regarding the Content Construction Kit Module

Updated 5/8/06

The CCK (content construction kit) module was released only 2 days ago. I've been working with it for only the past 2 hours, and I'm ecstatic. In terms of its overall usefulness, I'd say its in the same category as simplenews, views, and tinyMCE (read: no drupal developer, consultant, or amature should be without it).

In many ways, this module will likely signal death for flexinode. Which doesn't really bother me, because I never used flexinode. While flexinode still has more 'flexibility' in terms of defining all varieties of different fields, it has serious themability issues which have prevented me from ever using it. Moreover, where as flexinode created something of a pseudo-node type, CCK creates full fledged node types that have all the options, workflows, and permissions levels. But perhaps most exciting is how easy it is to theme your custom fields. To get you started, I've written a quick tutorial on exactly that:

LIBERATION FROM THE NODE BOX

The fields of your content type can be themed in whatever order and fashion you wish. In this example, we've created a Press Release content type with three defined fields named  body, subheading, and contactinfo.

Step One: Create a press release template by renaming a copy of your node.tpl.php file to node-content-press_release.tpl.php. Note that all CCK content types follow the same format:

node-content-[the name you gave your content type with underscores in place of spaces].tpl.php

Step Two: Let's say that you wanted the press-release's subheading to appear directly above the body. Here's all you have to do:

Delete everything in between the <div class="content"></div> tags, and replace it with the following:

<h4 class="press-release-subheading"><?php print $node->field_subheading['value']; ?></h4><div class="content"><?php print $node->field_body['value']; ?><h3>Media Contact</h3><?php print $node->field_contactinfo['value']; ?></div>

See the pattern? $node->field_"("the name you gave your field")"['value'];

No additional variables are required.  Though you should probably use some CSS to style it up.