Create an Event Listing With Calendar Block in Drupal 7
Click here to load reader
-
Upload
matt-janecek -
Category
Documents
-
view
602 -
download
2
description
Transcript of Create an Event Listing With Calendar Block in Drupal 7
Get Started Community Documentation Support Download & Extend Marketplace About
Step by step guide to create an event listing with calendar block in Drupal 7
Community Documentation
Community Docs Home Installation Guide Administration Guide
Page status
Needs technical review
Log in to edit this page
About this pageDrupal versionDrupal 7.x
AudienceProgrammers, Site administrators
LevelIntermediate
Keywords
Calendar , D7 , Date , Drupal 7
Site Building GuideBest practicesBuilding the site functionality
Access ControlActions and WorkflowsCRM SystemsCommerce and AdvertisingConnecting to other Sites,Systems, and DataContent Authoring ModulesContent Display ModulesContent ModulesContent RecommendationDates and Events
Booking TimeslotsBooking shared resourcesDate/Calendar
TROUBLESHOOTING:Debugging date andcalendar problemsDrupal 7Date/Calendar
Date Field TypesDate Locale &Time ZonesettingsCookbook:
Drupal Homepage Log in / Register
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 aworking example. It is recommended to install and test this feature module first and diveinto the step by step guide if needed.If you get "The calendar row plugin is required when using the calendar style, but it ismissing." 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 filtersthem.
Download and enable the required moduleslatest development build of calendar, date, ctools and views modulescontext and context_ui.features (needed by the feature module mentioned above).
Create an Events content typeGo to Structure > Content types > Add content type (admin/structure/types/add) andcreate one with the following settings:
Name: EventFields: Add a field of type Date, field name event_date and label Date(s). In the fieldconfiguration screen check the "Required field" and "Collect an end date" checkboxes.Create three or four events at the "Add content" (node/add/event).
Create a view to list eventsGo to Structure > Views > Add new view (admin/structure/views/add) and create a viewshowing 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 whenediting the view):
In the search field type "Date: Date (node)", once found click on "Add and configurecontextual filters".
1.
At the "When the filter value is NOT in the URL", select "Provide default value".2.At Type in the drop-down list, select Current Date.3.At Date field(s), select "field_event_date".4.At Method, select "AND".5.Save.6.
Create a calendar block for eventsClone the view "Calendar" into "Events calendar". ›› UPDATE (2012-08-23, related toCalendar 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 fromtemplate"; Views + Calendar templates.
1.
Select the Block display and add a filter by content type so it only lists content of type"Event".
2.
Edit the Contextual Filter so it looks exactly the same as the one we configured at theEvents view. ›› UPDATE (2012-08-23, related to Calendar 7.x-3.4): this is already set
3.
Search drupal.org
Refine your search
Step by step guide to create an event listing with calendar block in Drupal 7... http://drupal.org/node/1250714
1 of 5 12/21/2012 8:56 PM
Prepare anEvent-Calendarfor Drupal 7Cookbook: Use aspecialDate-FormatD7 OrganicGroup CalendarsDate APIDateObject Classand FunctionsDate FormElementsStep by stepguide to createan event listingwith calendarblock in Drupal 7
Drupal 6Date/CalendarArchive: Drupal 4.7 &5 Date/Calendar
Event modulesGCal EventsInstallation instructions forEventbookingsMERCI (ManageEquipment Reservations,Checkout and Inventory)Project: a rich set of toolsfor (software) projectmanagementSigning up for events withCCK Signup (Drupal 7)Signing up for events withCCK SignupSignup integration forUbercart (UC_Signup)Storm (projectmanagement application)Subscriptions (Subs)Timeline Module
Documentation toolsDynamic menu elements withtokensE-Mail and MessagingFeatures packagesFormsGames and AmusementsGeographical data and mapsInput formatsMedia and Files (D6, D7)SearchSearch Engine OptimizationSocial Networking andCollaborationUser-Generated ContentWYSIWYG configuration /image handling / editor rolemanagement
Contributed modulesCore modulesDistributionsHowTosSWFAddress: Browser History and
‹ Date Form Elements up Drupal 6 Date/Calendar ›
Login or register to post comments
Login or register to post comments
when using the appropriate template (see the screenshot in step 1).Save.4.
Add the calendar block to the events viewUsing Context module, create a context (admin/structure/context/add) so if thecondition is the Events view, display the "Events Calendar" block in the sidebar
1.
Save the context2.Verify that opening /events lists the created events with a calendar block at thesidebar.
3.
Link the calendar block links with the events viewAdd the following code to your default theme. Remember to change "yourtheme" by thename 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'];
}
?>
Login or register to post commentsLooking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.
Comments
Calendar problemsPosted by gtrennert on September 21, 2011 at 10:34am
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 ?
RequirementsPosted by juampy on September 21, 2011 at 11:16am
Does your test meet the requirements for the required modules? (See "Download andenable the required modules" at the top of the page).
Issue with future events by day in events viewPosted 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.
Step by step guide to create an event listing with calendar block in Drupal 7... http://drupal.org/node/1250714
2 of 5 12/21/2012 8:56 PM
Deep-Linking for Flash/FlexSite recipes
Drupal’s online documentation is ©2000-2012 by the individual contributors andcan be used in accordance with the CreativeCommons License, Attribution-ShareAlike2.0. PHP code is distributed under the GNUGeneral Public License. Comments ondocumentation pages are used to improvecontent and then deleted.
Login or register to post comments
Login or register to post comments
Login or register to post comments
Login or register to post comments
Login or register to post comments
Lets say I have an event on 2011-12-24
events/2011-12-24 <- shows nothingevents/2011-12 <- shows all events in 2011-12, including -24events/2011 <- shows correctly too
All events in the past work fine. The upcoming events block also works correctly.
Any ideas?
Number links going to page not foundPosted 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 withevents 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 posttypes and the event titles work just fine, but when I click the numbers I get sent to a pagenot found (www.mydrupalinstall.com/events/2012-01-11). This also happens when I usethe block calendar and click on a number.
When I disable the module the numbers take me to the day view of the calendar and showthat days events.
I have tested (www.mydrupalinstall.com/events/) and get page not found. Am I missingsomething? Why are the numbers pointing to "/events/2012-01-11" and not the event? AmI 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.
same issuePosted 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 theday and displays the follow message on my calendar (click to see all xxx events). Hereis the problem the URL doesn't show up like the example my-drupal-install.com/calander/month/2012-05-01 instead it shows up like this my-drupal-install.com//2012-05-01.
I tried both ways but none shows the list of my events.
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 ofmaking calendars?
has-event classPosted 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. Thecalendar return the classes has-events an has-no-events, but it returns has-events for daythat has no event registred.I will have to code this part to return the correct class? Or in the new version this featureis coded?
Thanks.
Event content type uninstallable/undeletable?Posted by AbelT on June 26, 2012 at 9:06am
Hello,
Step by step guide to create an event listing with calendar block in Drupal 7... http://drupal.org/node/1250714
3 of 5 12/21/2012 8:56 PM
Login or register to post comments
Login or register to post comments
Login or register to post comments
Login or register to post comments
Login or register to post comments
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 thecheckbox at the module list.The views that were created automatically when the modulewas 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'tgot 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
Not deleteablePosted 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 bethe case.
It's how Features module workPosted by juampy on August 1, 2012 at 8:48am
To delete a content type from a feature, you need to recreate the feature withoutit. Then you can delete it.
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 withoutit"????
Can you explain a bit deeply, please?
Thank you!
Abel T
Let's move to the issue queuesPosted by juampy on August 3, 2012 at 9:33am
This page is informative. Feedback related with errors it is better handled atthe 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.
need clarificationPosted 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
Step by step guide to create an event listing with calendar block in Drupal 7... http://drupal.org/node/1250714
4 of 5 12/21/2012 8:56 PM
Drupal NewsPlanet DrupalAssociation NewsSocial Media DirectorySecurity AnnouncementsJobs
CommunityGetting InvolvedServices, Training & HostingGroups & MeetupsDrupalCon
Get StartedDocumentation HomeInstallation GuideSite Building GuideSupportapi.drupal.org
Download & ExtendDrupal CoreModulesThemesDistributions
AboutDrupliconThe Drupal AssociationAdvertiseAbout Drupal.orgWeb accessibility
Drupal is a registered trademark of Dries Buytaert.
Login or register to post comments
Login or register to post comments
Login or register to post comments
Also, I want this to reside in the main content of a page, not a sidebar. Does the code youprovided still apply?thanks
The Context module enablesPosted by pushka on August 22, 2012 at 7:02am
The Context module enables you to create rules and reactions. For example, if a pagehas path 'blog/*' then 'display the Blog Archive block in the right sidebar region'. Soyou can use Context to enable the calendar block on a specific Views page. Contextmodule is very flexible.
To display the calendar block (or any block) in the main content of a page, you canplace it in the Content region. Or if this doesn't fit with your layout/theme, considerusing Panels module which provides much more flexibility for placement of pageelements (though a fair bit more complexity too).
Hi, All working for me inPosted 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'supdate date. But, if I select Date: Date (node), like explained in this tutorial - I get andempty calendar!!!The interesting thing, that in $view object the needed nodes do exist, and running view'squery directly against the database returns me my Event nodes. But the calendar isempty!!!
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 bytheir creation date dates - it seems like the Calendar's object totally ignores my customdate fields.
What am I doing wrong?Any help would be appreciated.
Step by step guide to create an event listing with calendar block in Drupal 7... http://drupal.org/node/1250714
5 of 5 12/21/2012 8:56 PM