Cách tạo một trang Calendars trong Drupal 7

Cách tạo một trang Calendars trong Drupal 7

We're going to show you how to create an event calendar in Drupal.

This tutorial is ideal for people who want to show a monthly, weekly or daily list of upcoming events.

First, we'll show you how to set up a basic Calendar and then we'll modify it to the needs of your content.

Installation

You'll need to enable and install these modules:

When you're enabling these modules, make sure to enable both Date API and Date Views.

Setting up the calendar

Go to Structure > Views > Add view from template.

media_1371647626258.png

You'll now see a variety of default Views that can be created.

  • Click add next to "A calendar view of the 'created' field in the 'node' base table".

media_1371647669125.png

  • Choose a name of your new Calendar view.
  • Click Continue,

media_1371647861090.png

  • Scroll to the bottom of the page for the preview.
  • You'll see that there's a calendar view with content inside.

media_1371647880886.png

  • Click Save in the top-right corner of your View.
  • Visit the site's homepage.
  • There will be a link in the Navigation menu to your Calendar.

media_1371647903708.png

  • You'll see your calendar on your site. The first tab will be a Month view.

media_1371647931988.png

  • Click the tabs across the top to get a Week, Day and Year view:

media_1371647950715.png

At the moment the calendar looks good, but we have some problems:

  • The calendar is showing all of the content on our site, not just events.
  • The calendar is sorting the content by the date it was published, not the date the event is happening.

Let's modify the calendar to fix those problems.

Modifying the Calendar

The first thing we need to do is make sure we have a place to list our Events. If you haven't done so yet. we'll create a content type called Events.

  • Go to Structure > Content types > Add content type
  • Enter Events as the Name
  • Click Save and add fields
  • Create a field called Date and choose Date as the type of data to store.
  • Click Save, then Save field settings, then Save settings.

media_1371648217889.png

Your Events content type should like at least a little like this:

media_1371648244320.png

  • Go to Structure > Views
  • Click Edit in the row for our Calendar view.
media_1371651090082.png

We need to change two things on the left-hand side of our view. We need to change:

  1. Fields
  2. Filter Criteria
  3. Sort Criteria

media_1371648336204.png

First, let's change the Fields. We're going to remove the date that the content was posted to our site.

  • Click Content: Post Date
  • Click Remove

Now we're going add the date of the events:

  • Click Add next to Fields.
  • Choose Content: Date
  • Click Apply (all displays) twice

When you're finished, your Fields area will look like this.

media_1371648484344.png

Second, we're going to use Filter Criteria to make sure that only our Events show on the calendar.

  • Click Add next to Filter Criteria.
  • Choose Content: Type
  • Click Apply (all displays)
  • Choose "Is one of" and then "Events".
  • Click Apply (all displays)

media_1371648559433.png

Your Filter Criteria will look like this:

media_1371648611595.png

Now we need to look to the right-hand side of our Views editing screen.

  • Under Contextual Filters, click Date: Date (node) (Content: Post date)

media_1371649163260.png

  • At the top of the screen, make sure you are configuring this option for All displays:

media_1371649534444.png

  • Uncheck Content: Post date
  • Check Content: Date (field_date)
  • Click Apply (all displays)

media_1371649188435.png

  • Check the preview of your view and your events should be showing on the date they will happen.
  • Click Save
  • Visit your finished calendar on the front of your site.

media_1371651971852.png

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Cựu nhân viên Google trở thành tân CEO của Yahoo!

Cựu nhân viên Google trở thành tân CEO của Yahoo!

Theo tờ thời báo New York, lãnh đạo lâu năm của Google sẽ bắt đầu dẫn dắt Yahoo! vượt qua khó khăn sau một loạt các rắc rối liên quan đến vị trí CEO của công ty.

Nhìn lại Drupal Association CTO: 1 năm qua - Drupal

Nhìn lại Drupal Association CTO: 1 năm qua - Drupal

Drupal Association CTO Joshua Mitchell shares many of the improvements to the Drupal.org and supporting techonolgy around 

Google adsence

Những điều cần tránh khi kiếm tiền với Google Adsense

Khi trang web bạn đã có traffic, có thứ hạng cao trên bộ máy tìm kiếm thì bạn có thể kiếm tiền từ nhiều nguồn khác nhau không chỉ riêng gì Google Adsense. Nhưng ai cũng biết một điều, Google Adsense là công ty trả tiền tốt nhất tại thời điểm hiện tại. Tuy nhiên không phải website với nội dung nào cũng được Google Adsense chấp nhận. Để tránh tình trạng không đăng ký được Google Adsense hoặc bị disable ads, ban account, bạn phải theo đúng quy định của họ.

Công ty diệt chuột T&C

 

Diet con trung