CCK And Views Drops
These are drops that provide information about CCK and/or Views.
Adding Fields With CCK
This drop shows how to add extra fields to existing content types (such as blog posts) using the Content Construction Kit (CCK) module in Drupal 6.
Creating A Page View From A Taxonomy
This video shows the user how to use the views module in Drupal 6 to create a page that list nodes with a certain taxonomy term. For the screencast I created a view that lists all of the nodes tagged with cck or views at http://www.learnbythedrop.com/cckandviews.
CCK Module Basics
Content Construction Kit (CCK) is one the most important and at the same time most mystifying features of the Drupal platform. In this drop I'll provide a high level overview explanation of CCK and why you might want to use it on your site.
What is CCK?
CCK is a contributed module that allows you to:
- Add fields to an existing Drupal content type
- Create new custom content types
Drupal Content Types
It's important to understand a bit about Drupal content types. Drupal comes standard with blog, page and story content types. The main difference between these content types is the way they are organized by the system.
- Blogs are associated with a particular user and will be listed at 'http://www.yoursite.com/blog' which shows all blog posts by all users. Blogs will also be listed on page that shows only posts by a particular user. The url for those pages may be something like 'http://www.yoursite.com/blogs/[username]'.
- Pages will simply have a url " and not show up in any lists unless you take some sort of action to do add them to a list.
- Stories are like pages except that they are automatically promoted to the front page.
The common thread across these three types of content types is that by default they contain two fields called Title and Body. But what if you want to expand a content type to add more fields? That's where CCK comes in.
Adding Fields
CCK allows you to add one or more fields to an existing content type. There are a number of reasons why you might want to do that. You could add fields to improve your workflow. If you're publishing video you might want to add a link to the video each time you post. Adding a field that is required when you submit ensures that you won't forget to add the link. See my post Adding Fields With CCK for an example.
You could also add a field to make it easier for you to organize or theme your content later. When a piece of information is entered into the body field you can't really sort that piece of information or use it if you want to create a list using views. But once a piece of information has it's own field you have much more flexibility. Using the video publishing as an example once again you might add a field that displays the duration of a video that is linked to a post.
Creating New Content Types
If you want ultimate flexibility in customizing your content types then you can use CCK to create a whole new content type that meets your specifications. Imagine that you want to be able to add information about your favorite DVDs to your Drupal site. The title and body fields probably won't meet your needs. You might want fields that list the Director of the movie, the top stars, release date, rating, an image, a link to the trailer and more. CCK was tailor made for things like this.
How Does CCK Work?
Many people are confused about how exactly to put CCK to use on their own website. You get started by downloading the module from http://drupal.org/project/cck but you will likely have to do more. The power of CCK is in the types of fields that it allows you to add to a content type. The contributed module includes several standard fields (like text and node reference) included but many of the fields you would want to add to your content type must be downloaded and enabled separately.
Here are some additional fields that are listed on the CCK module page on Drupal.org:
- Computed field: lets you add a PHP-driven "computed field" to CCK node types
- Date: creates an ISO or unix timestamp date field
- Email: validated email field
- Image field: an image field
- Link: a URL field
There are many other fields that you could use to customize your content type. These can be found in the CCK modules section on Drupal.org. Some of the interesting fields that you might want to add are listen below.
- Addresses
- Fivestar (content ratings)
- Slideshow Creator
- Video Upload (for YouTube)
What Next?
Your new content type is basically a list of fields that are ordered a certain way. Creating a new content type and adding fields is only part of the work you'll need to do in order to make CCK work for you on your Drupal site. Each field that you add has settings that must be attended to. You may also be concerned with how the new content type is displayed when you publish a node. The Contemplate module allows you to adjust the layout and customize the appearance of content types. If the content type you have created is brand new then you will need to use the Views module to create a page, block or RSS feed for the content.
Another thing to consider when creating a new content type is the path to the nodes that you create. By default content created on your Drupal site will have a path that looks something like 'http://www.yoursite.com/node/24'. If you're submitting the DVD content type that I mentioned above you might want to the path to be something like 'http://www.yoursite.com/dvd/[movie-title]. That's why I highly recommend the PathAuto module for automatic node url creation.
CCK Screenshots
These are screenshots that show what CCK features look like in the adminstration section of this site.
- learnbythedrop's blog
- 4 comments
- 1898 reads
Delicious
Digg
StumbleUpon
Google
Introduction To Views
This video gives you a very basic introduction to the views module in Drupal 6.
You can purchase a high resolution version (QuickTime, 1024x600) of this lesson for only $2.99 here.
- learnbythedrop's blog
- 5 comments
- 7511 reads
Delicious
Digg
StumbleUpon
Google
Significant Changes To Views For Drupal 6
There have been significant changes to the interface for creating views in Drupal 6. This site is based on Drupal 6 and I've had the opportunity to work with the new interface for the first time.
The new process can be a bit confusing so I recommend that you experiment with some sample views before jumping in. Once you get to know the new functionality I think you will find that it is a very nice improvement over previous versions of Drupal.

