【问题标题】:Cannot get fullcalendar to display events from a Google calendar无法获取完整日历以显示 Google 日历中的事件
【发布时间】:2012-03-12 21:59:19
【问题描述】:

这很奇怪。我只是想通过共享的 Google 日历来建立 fullcalendar 的基本功能。我尝试用我自己的日历 URL 简单地替换 gcal 演示“gcal.html”。日历自行打开。这是一些代码:

<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 插入地址栏中时,我的日历就会打开。此日历设置为公开。任何帮助,将不胜感激。完整的日历与谷歌日历似乎是一个很好的搭配,如果我能让它工作的话。

【问题讨论】:

    标签: fullcalendar


    【解决方案1】:

    您使用的网址不正确。 FullCalendar 需要一个 XML 提要,而不是您提供的整个日历。

    See the documentation.

    尝试以下步骤:

    您必须首先公开您的 Google 日历:

    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 供稿 URL:

    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

    【讨论】:

    • 谢谢布兰登!知道这很愚蠢,但我的眼睛看不到它。谢谢!
    • @Will,没问题。如果这解决了您的问题,请不要忘记您可以通过选中复选标记将其标记为已接受的答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-15
    • 2020-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多