Events listing system using Date, CCK and Views modules – Part 1

Events listing system using Date, CCK and Views modules – Part 1

This tutorial was originally requested by droople.

In this tutorial we will be creating an events listing system using CCK, Date and views as opposed to using the events and calendar modules.

I’m going break this tutorial up into 3 parts so it’s manageable. In part 1 I’m going to check we have the right modules installed and then look at the CCK setup of our events system.

Module Installation
For this tutorial you’ve probably worked out we’re using the CCK, Date and Views modules, but these modules all contain other “sub” modules so i’ll quickly run through which ones you need and don’t need.

On your Modules page (http://yoursite.com?q=admin/build/modules) verify you have the following modules installed:
CCK
Content
Text

Date/Time
Date
Date API
Date Popup
Date Timezone

Views
Views
Views UI

If you got those modules installed you’re ready to begin.

CCK Setup
Ok the first thing we need to do is create a new content called “event”.
Step 1 – Create your content type

Go to http://yoursite.com?q=admin/content/types/add
(admin > Content management > Content Types > Add content type)
In the add content form input the following:
Name: Event
Type: event (lowercase)
Title field label: Event Name
Body field label: Event Description
The other fields can be adjusted to whatever preference you like.
Click the “Save content type” button at the bottom, your new content type is now saved. You’re now ready to add fields to it.
Step 2 – Add new fields to your content type

At your content type admin page (admin/content/types) click the edit link under “operation” for the event content type we just made.
Then you click the “Add field” tab along the top.
We are going to now add a start and an end date for our events, so:
Start Date
Name: Start Date
Field Type: datestamp > Text Field with jquery pop-up calendar
(If you don’t see a “Text Field with jquery pop-up calendar” option go to the modules page and make sure you have the “Date Popup” module install under Date/Time).

On the next screen everything can stay as it is minus the following:
Widget settings > Default value: Now
Data settings > Required: True (check the box)
Now repeat steps 1 to 3 exactly the same but change the Name (on the first form screen) to End Date rather than Start Date.

Great! Our events now have a start and an end date, optionally you can now tweak the form order by going to http://yoursite.com?q=admin/content/types/event/fields and adjusting the weight of each form item
Step 3 – Add some events
Let test out our new event content type by adding some new events.
Go Create Content > Event and add 5-6 events.

Well done you’ve completed part 1 and CCK is all set up and ready to use!
Next up we’ll look at using Views to create an events list page.

Leave a Reply

Your email address will not be published. Required fields are marked *