Вы находитесь на странице: 1из 5

Step by step guide to create an event listing with calendar block in Drupal 7...

http://drupal.org/node/1250714

Get Started

Community

Documentation

Support

Download & Extend

Marketplace

About

Search drupal.org Drupal Homepage Log in / Register

Refine your search

Community Documentation
Community Docs Home Installation Guide Administration Guide

Step by step guide to create an event listing with calendar block in Drupal 7
Last updated September 5, 2012. Created by juampy on August 16, 2011. Edited by gambry, Sk8erPeter, KarenS, jmary. Log in to edit this page. The contents of this guide should be tested along the Events calendar feature module as a working example. It is recommended to install and test this feature module first and dive into the step by step guide if needed. If you get "The calendar row plugin is required when using the calendar style, but it is missing." notices, you should uninstall the feature and follow the steps below. Below are the list of steps to create an events listing with a calendar block which filters them.

Page status
Needs technical review Log in to edit this page

About this page


Drupal version Drupal 7.x Audience Programmers, Site administrators Level Intermediate Keywords Calendar , D7 , Date , Drupal 7

Download and enable the required modules


latest development build of calendar, date, ctools and views modules context and context_ui. features (needed by the feature module mentioned above).

Create an Events content type


Go to Structure > Content types > Add content type ( admin/structure/types/add ) and create one with the following settings: Name: Event Fields: Add a field of type Date, field name event_date and label Date(s). In the field configuration screen check the "Required field" and "Collect an end date" checkboxes. Create three or four events at the "Add content" ( node/add/event ).

Site Building Guide


Best practices Building the site functionality Access Control Actions and Workflows CRM Systems Commerce and Advertising Connecting to other Sites, Systems, and Data Content Authoring Modules Content Display Modules Content Modules Content Recommendation Dates and Events Booking Timeslots Booking shared resources Date/Calendar TROUBLESHOOTING: Debugging date and calendar problems Drupal 7 Date/Calendar Date Field Types Date Locale & Time Zone settings Cookbook:

Create a view to list events


Go to Structure > Views > Add new view ( admin/structure/views/add ) and create a view showing nodes of type "Event". Click on "Save and edit". Set the path of this page view to /events . Add the following Contextual Filter (find the link at the Contextual Filters block when editing the view): 1. In the search field type "Date: Date (node)", once found click on "Add and configure contextual filters". 2. At the "When the filter value is NOT in the URL", select "Provide default value". 3. At Type in the drop-down list, select Current Date. 4. At Date field(s), select " field_event_date ". 5. At Method, select " AND ". 6. Save.

Create a calendar block for events


1. Clone the view "Calendar " into "Events calendar". UPDATE (2012-08-23, related to Calendar 7.x-3.4): you should rather use "Add view from template" on admin/structure /views depending on the appropriate field. Sample screenshots: "Add view from template"; Views + Calendar templates. 2. Select the Block display and add a filter by content type so it only lists content of type "Event". 3. Edit the Contextual Filter so it looks exactly the same as the one we configured at the Events view. UPDATE (2012-08-23, related to Calendar 7.x-3.4): this is already set

1 of 5

12/21/2012 8:56 PM

Step by step guide to create an event listing with calendar block in Drupal 7...

http://drupal.org/node/1250714

when using the appropriate template (see the screenshot in step 1). 4. Save.

Add the calendar block to the events view


1. Using Context module, create a context ( admin/structure/context/add ) so if the condition is the Events view, display the "Events Calendar" block in the sidebar 2. Save the context 3. Verify that opening /events lists the created events with a calendar block at the sidebar.

Prepare an Event-Calendar for Drupal 7 Cookbook: Use a special Date-Format D7 Organic Group Calendars Date API DateObject Class and Functions Date Form Elements Step by step guide to create an event listing with calendar block in Drupal 7 Drupal 6 Date/Calendar Archive: Drupal 4.7 & 5 Date/Calendar Event modules GCal Events Installation instructions for Eventbookings MERCI (Manage Equipment Reservations, Checkout and Inventory) Project: a rich set of tools for (software) project management Signing up for events with CCK Signup (Drupal 7) Signing up for events with CCK Signup Signup integration for Ubercart (UC_Signup)

Link the calendar block links with the events view


Add the following code to your default theme. Remember to change " yourtheme " by the name of the default theme. This code shoud reside at sites/all/themes/yourtheme
/template.php <?php /** * Alters link url in calendar events block in order to filter events at /events * * @see template_preprocess_calendar_datebox() */ function yourtheme_preprocess_calendar_datebox(&$vars) { $date = $vars['date']; $view = $vars['view']; $day_path = calendar_granularity_path($view, 'day'); $vars['url'] = 'events/' . $date; $vars['link'] = !empty($day_path) ? l($vars['day'], $vars['url']) : $vars['day']; } ?>

Date Form Elements

up

Drupal 6 Date/Calendar

Login or register to post comments Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments
Calendar problems
Posted by gtrennert on September 21, 2011 at 10:34am

Storm (project management application) Subscriptions (Subs) Timeline Module Documentation tools Dynamic menu elements with tokens E-Mail and Messaging Features packages Forms Games and Amusements Geographical data and maps Input formats Media and Files (D6, D7) Search
Login or register to post comments

Hello, I can see that there are technical reviews needed, but I tried out this step by step : My problem is : when clicking on an date with event in the calendar (i.e. 20 oct), i get : 1) a second calendar below the first one with a totally other date with event (i.e. 30 oct) 2) This message : Debug : 'calendar_plugin_style: Missing calendar row plugin' dans calendar_plugin_style->render() (ligne 205 dans ...\sites\all\modules\calendar \includes\calendar_plugin_style.inc). Can you give me a hint how to get this thing working ?

Search Engine Optimization Social Networking and Collaboration User-Generated Content WYSIWYG configuration / image handling / editor role management Contributed modules Core modules Distributions HowTos SWFAddress: Browser History and

Requirements
Posted by juampy on September 21, 2011 at 11:16am

Does your test meet the requirements for the required modules? (See "Download and enable the required modules" at the top of the page).
Login or register to post comments

Issue with future events by day in events view


Posted by teekay78 on November 18, 2011 at 1:50pm

I have a strange issue. I cannot acces future events via the link in the calendar.

2 of 5

12/21/2012 8:56 PM

Step by step guide to create an event listing with calendar block in Drupal 7...

http://drupal.org/node/1250714

Lets say I have an event on 2011-12-24 events/2011-12-24 <- shows nothing events/2011-12 <- shows all events in 2011-12, including -24 events/2011 <- shows correctly too All events in the past work fine. The upcoming events block also works correctly. Any ideas?
Login or register to post comments

Deep-Linking for Flash/Flex Site recipes


Drupals online documentation is 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.

Number links going to page not found


Posted by kcharity on January 11, 2012 at 12:25am

I have tried to get this going but have ran into a little roadblock. I have 2 post types with events in both types created. When I go to the monthly calendar (www.mydrupalinstall.com/calendar/month) I am shown all the events for those two post types and the event titles work just fine, but when I click the numbers I get sent to a page not found (www.mydrupalinstall.com/events/2012-01-11). This also happens when I use the block calendar and click on a number. When I disable the module the numbers take me to the day view of the calendar and show that days events. I have tested (www.mydrupalinstall.com/events/) and get page not found. Am I missing something? Why are the numbers pointing to "/events/2012-01-11" and not the event? Am I supposed to create a new view that lists all events for a certain day? I am still a bit green when it comes to Drupal so please be gentle.
Login or register to post comments

same issue
Posted by antoineyow on January 11, 2012 at 1:00am

i have a similar issue basically my view sum up the amount of events I have for the day and displays the follow message on my calendar (click to see all xxx events). Here is the problem the URL doesn't show up like the example my-drupalinstall.com/calander/month/2012-05-01 instead it shows up like this my-drupalinstall.com//2012-05-01. I tried both ways but none shows the list of my events.
Login or register to post comments

Future-proof?
Posted by pushka on March 13, 2012 at 5:25pm

I wonder if the same can be achieved using the new create-from-template process of making calendars?
Login or register to post comments

has-event class
Posted by davifr359 on June 22, 2012 at 12:31pm

I need to hilight the days - in the calendar - with have at least one event for it. The calendar return the classes has-events an has-no-events, but it returns has-events for day that has no event registred. I will have to code this part to return the correct class? Or in the new version this feature is coded? Thanks.
Login or register to post comments

Event content type uninstallable/undeletable?


Posted by AbelT on June 26, 2012 at 9:06am

Hello,

3 of 5

12/21/2012 8:56 PM

Step by step guide to create an event listing with calendar block in Drupal 7...

http://drupal.org/node/1250714

As I have seen, this step by step guide shows all steps that the "Event Calendar feature" module makes. I tested it in my site, but I saw it was not appropiate for me. I defused using it clearing the checkbox at the module list.The views that were created automatically when the module was enabled, dissapeared, OK. I deleted the content created for testing module. And when I go to delete the "Events" type content, I find that this type of content hasn't got the "Delete" option. If I have deleted all related content, I should be able to delete this type of content, shouldn't I? What's the problem? Thank you very much.
Abel T Login or register to post comments

Not deleteable
Posted by kenyan on July 31, 2012 at 10:08pm

Same here, This wasn't 'working' for me either so I uninstalled the feature and all related content. The Event content type though is now a real pain. There is no way to remove it. I guess this means having to delve into the database but this should not have to be the case.
Login or register to post comments

It's how Features module work


Posted by juampy on August 1, 2012 at 8:48am

To delete a content type from a feature, you need to recreate the feature without it. Then you can delete it.
Login or register to post comments

Recreate the feature???


Posted by AbelT on August 2, 2012 at 9:52am

Hello, Thanks for your help but.... what does it mean "recreate the feature without it"???? Can you explain a bit deeply, please? Thank you!
Abel T Login or register to post comments

Let's move to the issue queues


Posted by juampy on August 3, 2012 at 9:33am

This page is informative. Feedback related with errors it is better handled at the module's issue queue (http://drupal.org/project/issues /events_calendar_feature?categories=All). Please find a related issue there or create one to keep on this discussion.
Login or register to post comments

need clarification
Posted by tiki16 on August 9, 2012 at 9:30pm

Hi Not sure what you mean here: Using context module, create a context so if the condition is the Events view, display the "Events Calendar" block in the sidebar

4 of 5

12/21/2012 8:56 PM

Step by step guide to create an event listing with calendar block in Drupal 7...

http://drupal.org/node/1250714

Also, I want this to reside in the main content of a page, not a sidebar. Does the code you provided still apply? thanks
Login or register to post comments

The Context module enables


Posted by pushka on August 22, 2012 at 7:02am

The Context module enables you to create rules and reactions. For example, if a page has path 'blog/*' then 'display the Blog Archive block in the right sidebar region'. So you can use Context to enable the calendar block on a specific Views page. Context module is very flexible. To display the calendar block (or any block) in the main content of a page, you can place it in the Content region. Or if this doesn't fit with your layout/theme, consider using Panels module which provides much more flexibility for placement of page elements (though a fair bit more complexity too).
Login or register to post comments

Hi, All working for me in


Posted by miraje on August 26, 2012 at 3:57pm

Hi, All working for me in case when in Contextual Filters I select node's creation date or node's update date. But, if I select Date: Date (node), like explained in this tutorial - I get and empty calendar!!! The interesting thing, that in $view object the needed nodes do exist, and running view's query directly against the database returns me my Event nodes. But the calendar is empty!!! Changing type of the Date field (ISO, Unix timestamp) doesn't help. Inserting to Contextual Filters also node's creation dates place nodes in the calendar by their creation date dates - it seems like the Calendar's object totally ignores my custom date fields. What am I doing wrong? Any help would be appreciated.
Login or register to post comments

Drupal News Planet Drupal Association News Social Media Directory Security Announcements Jobs

Community Getting Involved Services, Training & Hosting Groups & Meetups DrupalCon

Get Started Documentation Home Installation Guide Site Building Guide Support api.drupal.org

Download & Extend Drupal Core Modules Themes Distributions

About Druplicon The Drupal Association Advertise About Drupal.org Web accessibility

Drupal is a registered trademark of Dries Buytaert.

5 of 5

12/21/2012 8:56 PM

Вам также может понравиться