2012-03-12 70 views
0

这很奇怪。我只是试图用共享的Google日历来建立fullcalendar的基本功能。我尝试用我自己的日历URL简单地替换gcal演示“gcal.html”。日历自行开放。这里是一些代码:无法使用fullcalendar显示Google日历中的活动

<head> 
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> 
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' /> 
<script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script> 
<script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script> 
<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script> 
<script type='text/javascript' src='../fullcalendar/gcal.js'></script> 
<script type='text/javascript'> 

    $(document).ready(function() { 

     $('#calendar').fullCalendar({ 
     header: { 
       left: 'prev,next today', 
       center: 'title', 
       right: 'month,basicWeek,basicDay' 
      }, 
      // US Holidays 
      events: 'https://www.google.com/calendar/embed?src=r9k375tdhq8auc1oc4kgmhpri4%40group.calendar.google.com&ctz=America/Chicago', 
      eventClick: function(event) { 
       // opens events in a popup window 
       window.open(event.url, 'gcalevent', 'width=700,height=600'); 
       return false; 
      }, 

      loading: function(bool) { 
       if (bool) { 
        $('#loading').show(); 
       }else{ 
        $('#loading').hide(); 
       } 
      } 

     }); 

    }); 

</script> 

我非常确定,我拥有所有的依赖权利等,因为我在gcal演示。当我将URL插入地址栏时,我的日历将会打开。这个日历设置为公开的。任何帮助,将不胜感激。如果我可以使用它,Google日历的完整日历似乎是一个很好的配对。

回答

1

您没有使用正确的网址。 FullCalendar需要一个XML提要,而不是整个日历,这是你给它的。

See the documentation。以下步骤

尝试:

你必须先使你的谷歌日历市民:

In the Google Calendar interface, locate the "My Calendar" box on the left. 
Click the arrow next to the calendar you need. 
A menu will appear. Click "Share this calendar." 
Check "Make this calendar public." 
Make sure "Share only my free/busy information" is unchecked. 
Click "Save." 

然后,你必须取得日历的XML供稿网址:

In the Google Calendar interface, locate the "My Calendar" box on the left 
Click the arrow next to the calendar you need. 
A menu will appear. Click "Calendar settings." 
In the "Calendar Address" section of the screen, click the XML badge. 
Your feed's URL will appear. 

我相信这是你想要的网址

https://www.google.com/calendar/feeds/r9k375tdhq8auc1oc4kgmhpri4%40group.calendar.google.com/public/basic

+0

谢谢布兰登!知道这是愚蠢的,但我的眼睛不会看到它。谢谢! – Will 2012-03-12 22:09:56

+0

@会,没问题。如果这解决了您的问题,请不要忘记您可以通过选中复选标记将其标记为接受的答案。 – Brandon 2012-03-12 22:10:56

相关问题