
Drupal Tutorials
Events listing system using Date, CCK and Views modules - Part 2
Prerequisites
You should have read part one.
You should have read part one.
Rate this tutorial
Comments (24)
Thursday, November 27, 2008
By admin
This is part 2 of "Events listing system using Date, CCK and Views modules", if you missed part one you can find it here.
In part one we set up our event CCK node type so now we're going to look at setting up a view to list our events.
That's it you should now have a basic events system up and running.
Here's the exported views code from our events view
In the final part I'll look at possible ways you could improve this events system and take it further.
In part one we set up our event CCK node type so now we're going to look at setting up a view to list our events.
Views Setup
Lets not waste time and get stuck in to make our events view.- Go to yoursite.com/admin/build/views, click the "Add" tab and input the following details:
Basic Information fieldset
Name: events
Page fieldset
Provide Page View: Check the box
URL: events
View Type: Table View
Title: Events Listing
Use Pager: Check the box
Nodes per Page: Up to you I'm using 20 - Click the "Save and edit" button and scroll down to the Fields fieldset and select the following fields:
Node: Title
Datestamp: Start Date and input "Start Date" as the label
Datestamp: End Date and input "End Date" as the label
These are the fields that will show in our events table. - Click the "Save and edit" button again and scroll down the Filters fieldset and add the following filters:
Node: Type | Operator = Is One Of | Value = Event
Node: Published | Value = Yes
Datestamp: End Date - Date | Operator = greater than or equal to | Option = now
Here we are narrowing down which nodes our view should select by adding criteria.
We're using the End Date filter to only select events that haven't already happened by saying only select events where the events end date is greater than or equal to now ie. the end date hasn't already passed. - Click the "Save and edit" button yet again and scroll down to the Sort Criteria fieldset and select:
Datestamp: Start Date | Order = Ascending
Datestamp: End Date | Order = Ascending
This will ensure our events our ordered as they are happening ie. the events happening first are at the top.
That's it you should now have a basic events system up and running.
Here's the exported views code from our events view
$view = new stdClass();
$view->name = 'events';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Upcoming Events';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'events';
$view->use_pager = TRUE;
$view->nodes_per_page = '30';
$view->sort = array (
array (
'tablename' => 'node_data_field_start_date',
'field' => 'field_start_date_value',
'sortorder' => 'ASC',
'options' => '',
),
array (
'tablename' => 'node_data_field_end_date',
'field' => 'field_end_date_value',
'sortorder' => 'ASC',
'options' => '',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
array (
'tablename' => 'node_data_field_start_date',
'field' => 'field_start_date_value',
'label' => 'Start Time',
'handler' => 'content_views_field_handler_group',
'options' => 'medium',
),
array (
'tablename' => 'node_data_field_end_date',
'field' => 'field_end_date_value',
'label' => 'End Time',
'handler' => 'content_views_field_handler_group',
'options' => 'medium',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'event',
),
),
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node_data_field_end_date',
'field' => 'field_end_date_value_default',
'operator' => '>=',
'options' => 'now',
'value' => '',
),
);
$view->exposed_filter = array (
);
$view->requires = array(node_data_field_start_date, node_data_field_end_date, node);
$views[$view->name] = $view;In the final part I'll look at possible ways you could improve this events system and take it further.
Hey admin, Happy New
By droople on Wednesday, January 7, 2009Hey admin,
Happy New Year.
Any news on Part 3?
Thanks Droople, same to
By admin on Wednesday, January 7, 2009Thanks Droople, same to you!!
Funny you should ask, i started looking at this again yesterday (i got half way through before xmas), so it's in the pipeline.
I'll try and finish it for next week.
Cheers
Tom
Scrap that i've just put up
By admin on Wednesday, January 7, 2009Scrap that i've just put up part 3: http://drupalsn.com/learn-drupal/drupal-tutorials/events-listing-system-...
Hope you like it, tried to make it more advanced
Tom
i want to make calender
By computer_jin on Wednesday, April 29, 2009i want to make calender block and when i create any event it these event should show in calender block.tell me how it is posible?
I need to know how to do
By bromoney on Wednesday, October 7, 2009I need to know how to do this as well.
cd rates
calender making should not
By farazakan on Sunday, October 25, 2009calender making should not be that much difficult. pregnancy ultrasounds
I have created a calender
By computer_jin on Thursday, April 30, 2009I have created a calender block using cck it shows the events on date but when i click on this date it shows the bigger calender but its not showing the events detail.
Hi ,Thanks admin to give us
By computer_jin on Thursday, May 14, 2009Hi ,
Thanks admin to give us such a nice tutorial.
I want to ask you one thing i was trying to show only event time there dont want to show date than how can i do this? i have spent lots of time there ....
Thanks in Advance
Hi,You should be able to
By admin on Friday, May 15, 2009Hi,
You should be able to alter the event start and end dates to show just the time by editing the the start and end date fields.
Near the bottom of the form you should see a "Default Display" fieldset and then in the "*Custom display format:" textfield enter "h:i a" which will output a 10:30pm like time.
Hopefully that will help get you going
Tom
Hi,Thanks to reply me ,i
By computer_jin on Friday, May 15, 2009Hi,
Thanks to reply me ,
i did not find "Default Display" fieldset on the views page can you please tell me where is it and where i can find custom display format textfield ?
Thanks again for your reply
Hi,The "Default Display"
By admin on Friday, May 15, 2009Hi,
The "Default Display" fieldset is in your event content type.
Go to Administer > Content Management > Content Types and click the "manage fields" link next to your event content type.
Then from there click "configure" link next to the start and end date fields and on the next page you should see the "Default Display" fieldset.
Hope that helps
Tom
Thanks Tom , Its really help
By computer_jin on Friday, May 15, 2009Thanks Tom , Its really help me,
views module is amazing and i also use views module in drupal 6 it is also a soooooper module. I love this.
Thanks for your help.
If you will be there we can learn a lot from you .
Thanks again
Azhar
Hi again,I want to ask from
By computer_jin on Friday, May 15, 2009Hi again,
I want to ask from where i can find the full tutorial on views and cck module in drupal 6 or drupal 5 ?
I am setting up the view and
By aiche on Wednesday, August 19, 2009I am setting up the view and I don't see datestamp as an option to choose from the group dropdown when setting up the fields. I see content: start and end dates. I also don't see datestamp for filters.
When I defined the content type I did use datestamp for end and start dates. What am I missing?
I also want to ask from same
By robarthelfend on Thursday, September 24, 2009I also want to ask from same thing where i can find the full tutorial on views and cck module in drupal 6 or drupal 5 ?
I am really following all
By intheleedpat on Thursday, September 24, 2009I am really following all your tutorials. its really good instead of full tutorial. easy to understand.
As a learner it was nice to
By Brighton Dentist on Monday, October 12, 2009As a learner it was nice to know these things exist thank you very much for the post......
I learn a lot from this post
By jimmyjohnson1955 on Wednesday, November 11, 2009I learn a lot from this post too. I also want to say Thanks to the author for sharing.
Hello Admin,Nice tutorial.
By tejaspmehta on Thursday, October 22, 2009Hello Admin,
Nice tutorial. I am new to drupal and found your article. Its good one for beginner like me. When i tried this tutorial than Part 1 was easily set up but for Part 2 in View i did face lot of problem as i am using drupal 6. Also version of views module is different which you used. So is it possible that you can post new article or update this article with current version ? do let me know please. i want to complete this tutorial part 2 in my website.
Thank you.
Thanks you for help.Now i
By tejaspmehta on Thursday, November 5, 2009Thanks you for help.
Now i have one question. We have generated evenets and listing but how can i get that which user has signup for this event ? sorry if my question is silly but i am newbie to drupal so not getting clear idea.
Thank you.
You should check out the
By admin on Thursday, November 5, 2009You should check out the sign up module: http://drupal.org/project/signup
Thanks
What all events can be
By mnbv on Friday, November 13, 2009What all events can be listed using this method?
//Datestamp: End Date - Date
By jovemac on Wednesday, November 18, 2009//Datestamp: End Date - Date | Operator = greater than or equal to | Option = now//
I am not able to follow this action. I am using D6.
Please advise.





Delicious
Digg
StumbleUpon
Facebook
Google
Yahoo
Technorati


















