OK, so the Content Creation Kit is easily the most powerful module for Drupal. But only when paired with the Views module. The CCK module allows you to create custom content types. The Views module allows you to create a page that displays content that can be sorted, arranged, and displayed in almost any fashion, with some simple ajax functionality to boot.
To give an example of these two modules working in concert with each other, I will attempt to explain a recent site I built, along with talented interaction designer Parth Bhawalkar, completely in Drupal, the Stray Rescue of St. Louis website.
For Stray Rescue, we needed a way to allow non-expert computer users to add animals available for adoption to their website. I could have said, ok, let me build you a custom application for that, write something in a month, and deliver it to them. Then attempt to “train” them on it. Well, instead of wasting my time with that, I decided to build the site in Drupal 6 with CCK and Views powering some “custom application” functionality.
For this specific mini-application, I needed a way for users to add content into specific fields for name, age, breed, type of animal, thumbnail, full image, etc. With CCK, I was able to build a custom content type that allowed administrative users to enter some basic information about each animal, which would later be important when creating a View for this content type.
OK, so now admin users have a place to enter in this data. Great. But what about people actually looking for a pet? How can I give them an easy-to-use interface for browsing pets and applying to adopt one of them? Well, with a combination of CCK, Views, Contemplate, and Webforms, I was able to construct a path that allowed users to browse dogs or cats, select one they wanted to adopt, and submit an adoption application with the name of the pet pre-filled in the form.
The page above is the main pet listing page, which was built using Views. You can see the live page here. The configuration page for this specific view is shown in the image below:
This page took me a while to figure out, but basically, the Fields are the pieces of data you want to display and the Filters allow you to sort out the pages/content you don’t want to display or want the user to control. In my case, I only want to display any node with a type of “pet listing” and I want the user to be able to toggle the type of animal they are looking for in the list. To do that, I added another filter for Content: Type of Animal. That means the user can change the filter on the front-end to view only dogs or only cats.
Below is an actual pet listing page created when a pet is added. Contemplate provides a list of every piece of data available for this page and a quick and easy way to slap it into a template and override the default template with your own custom template.
This post was written to whet your appetite for Drupal and it’s amazing modules, CCK, Views, and Contemplate. If you are interested in learning more about how the Stray Rescue Drupal site is configured, I would be happy to share the knowledge I gained throughout the entire process. Drupal’s documentation is horrible, especially since there are multiple active versions and not every version has the same modules (at least not stable).
I recently discovered the Views 2 module and I’m in love. I don’t like to use the contemplate module because it is very “code” heavy. I’m really exited for the Panels 2 module to get our of alpha – that will, for me, replace the need for contemplate.
Great post. CCK and Views truly are essential Drupal modules. I believe everything that you’ve done with Contemplate could also be done with Views though, right? It seems to be more convenient for this type of thing.
Thanks for the great information!
By the way, anyone interested in helping out on Drupal Documentation team is welcome. There’s a lot of great work going on there and the more people that chip in with great content like this the better it will be for everyone.
Hey Dude,
Thanks for the post on my site.
I do like your article explaining the core functionality that makes Drupal such a powerful system.
As far as I know, the Views 2 module does not give you the flexibility that Contemplate does for layout and code processing (if needed). However, I am wrong all the time, and this may very well be one of those times.
One thing that is great about using Views and CCK is being able to use their pre-set design patterns for layout and then using CSS to style them consistently throughout your site. Double bonus.
Very useful – what I can’t figure out is how to get that data off in a usable form, CSV for example.
Excellent showcase of what Views and CCK can do. I would be interested in reading anything you had to say about explaining contemplate. I am trying to wrap my brain around that. I would like to use Views and CCK as well as contemplate in some upcoming web projects.
Thanks in advance.
How do you get the views filter to appear in a listbox.
On my test site I have lists of music by artist, song title, and album. I’d like to be able to filter by artist name using a dropdown listbox… but As of now, I can only filter by artist name using a text box.
Any ideas?
Thanks, Great post!
Elliott
It depends on how you defined that field in CCK. If you defined it as a listbox value, it should show up as a listbox when you pull it in as a filter in Views.
If you did not enter it as a list in CCK or do not want it to be a list, just show up in a drop-down on the front-end, I’m not sure what you need to do to set that up. If I have time to look at it, I can let you know what I find out.
Hi Chris,
love this post, and what you have done with drupal. I am interested in learning more about how you configured the Stray Rescue site, and would like to talk to you about it.
Thanks, Christo
Great post! I am building a site that displays cooking recipes, and can’t figure out how to use Contemplate to arrange each recipe’s information. I basically want the exact same layout you used on Stray Rescue. I don’t know PHP, do you have any resources that will enable me to use the Contemplate module in the same fashion as your design?
Thanks!
Hey great profile on how you’ve set up Stray Rescue. I’ve taken on the design for shelter as well and had come to the same conclusions… Drupal, Contemplate, View, & webforms. I’ve got it all worked out but this – ** How are you passing the variable of the animal name (node id probably) over to the webform field “What is the name of the pet are you interested in?:”
-Thanks for a hint!