docs:drupal:cck

This is an old revision of the document!


CCK

CCK is the Content Construction Kit module1) for Drupal. The module allows you to add custom fields to content types. For instance, you could add publisher, release date, etc… to a book review content type.

Another example might be a two column page content type (we'll call it tcpage). After creating this content type, CCK allows you to add fields. You could add one for field_leftcontent, and field_rightcontent. These fields could be text area types.

To control the output, you can easily do this with css. If you load the page without making any adjustments, the content of all fields will run together. This is a good time for you to view the page source to get a feel for what we are about to do. You probably want to have full control of the layout, so modify your css file:

.node-type-tcpage .field-field-leftcontent{
	float: left;
	width: 166px;
	border-left: 1px solid #BBB3B1;
}

.node-type-tcpage .field-field-rightcontent{
	float: left;
	width: 410px;
	border-left: 1px solid #BBB3B1;
}

.node-type-tcpage .field-label{
	display: none;
}

.node-type-tcpage .field-field-rightcontent .field-item, .node-type-tcpage .field-field-leftcontent .field-item{
	margin: 8px;
}

The CCK module allows you to disable the labels, but we've taken care of it with css here.


1)
CCK is slated to become part of core in Drupal 7.
  • docs/drupal/cck.1268979126.txt.gz
  • Last modified: 2010/03/19 00:12
  • by billh