Displaying date events in a calendar in drupal 6

Modules that need to be activated: Date API, which is the parent and makes all the other date functions work, Date module to create fields for cck which we add our date information into, date timezone, a module that is sensitive to the timezone of the website in the web server, and the calendar module, which allows views to display all this information on a date layout.

From admin>site configuration>date and time things like default time zone (Europe/Dublin in my case) and first day of the week can be configured.

I have an “event” content type with a title and a body, and I have added a custom field of name “Date”, with a type of data to store “date”, and a form element to edit the data of select list (under “date”). After saving this drupal takes us to the field configuration page, here we can set the behavior for this field; I made this field required, so any time that a user submits a date event this will need to be filled. I set the “to date” to “optional”, in case users want to set an end date or time the particular event extends to.

The user creating a type “event” of content will have to submit a title, body, and date (from- to), selecting in the last case from drop down lists.

How to display this date information? Enabling the “calendar” view that comes with the module, and adding a filter of node:type “event”, so that in the calendar only content of type “event” are displayed. By default the calendar displays the date an event is published rather than the cck event date field, in order to display this last we need to change the default argument from “node: updated date” to the cck field, down under “date fields”. We also need to output this cck field.

I duplicated the settings from this block to another one, with identical settings but with the purpose of displaying it on the content top region instead of the sidebar one. Drupal doesn´t allow (yet?) to output same block in different regions depending on the URL, that´s why this step had to be taken. So this block is displayed in the content top region of the events page, and only on this page.

Complementing this views, I thought it would be useful to create another view displayed to another block, to show in a list format the upcoming events´ title and date. Only the future events. This is addressed the same way than before, but with the following additions:

-adding a filter of Date:Date (node), where the “content: date- from date” uses an operator of “is greater than” now. The date default box has to be filled in with the word “now”, and drupal will pick it up and filter only the events that have a “from date” greater than today´s.

-adding also a sort criteria of “content:date-from date” in an ascending order, so that the next event will appear at the top of the list.

Finally, a view to a page that displays the event teasers and the calendar block on the content top region has been also created.

I found this link of great help: http://heim.ifi.uio.no/inf5270/tutorials/calendar.html

As well as this video screencast: http://gotdrupal.com/videos/drupal-calendar

And also: http://technopragmatica.blogspot.com/2009/04/showing-lists-of-events-in-drupal-6.html


Posted on April 8, 2010, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: