我有一个功能性的fullCalendar http://arshaw.com/fullcalendar/正在从Google日历中检索单个来源,用于这样的事件:
$('#calendar').fullCalendar({
events: $.fullCalendar.gcalFeed(
"http://www.google.com/calendar/feeds/etc", // feed URL
{ className: 'gcal-events' } // optional options
)
});
然而,我的挑战是有多个Feed ..coperCalendar文档说:
eventSources:Array 与“事件”选项类似,但可以指定多个源。例如,可以指定一个JSON URL数组,一个自定义函数数组,一个硬编码事件数组数组或任意组合。
但是没有例子,所以这里的JSON新手有点卡住了。
关于使用eventSources和Feed数组需要什么的任何想法?
答案 0 :(得分:9)
在这里找到解决方案; http://code.google.com/p/fullcalendar/issues/detail?id=192&q=eventSources
eventSources:
[
'msCal.txt', // location of Cal JSON script
'msLogBook.txt', // location of LogBook JSON object
'msEvents.txt' //location of the Events JSON object
]
回想起来非常简单。以下是我的测试页面;
eventSources:
[
$.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.australian%23holiday%40group.v.calendar.google.com/public/basic'),
$.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic'),
$.fullCalendar.gcalFeed('http://www.google.com/calendar/feeds/en.indonesian%23holiday%40group.v.calendar.google.com/public/basic')
],
答案 1 :(得分:1)
我遇到了同样的问题,上面的想法对我有所改变。我需要它在一个页面上显示5个日历,但在另一个页面上只显示1个日历,所以我这样做了。
<?php if (is_page("calendar")):?>
events:'...google calendar url #1...',
<?php endif; ?>
<?php if (is_page("meeting-schedule")):?>
eventSources: [
$.fullCalendar.gcalFeed('...google calendar url #1...'),
$.fullCalendar.gcalFeed('...google calendar url #2...'),
$.fullCalendar.gcalFeed('...google calendar url #3...'),
$.fullCalendar.gcalFeed('...google calendar url #4...'),
$.fullCalendar.gcalFeed('...google calendar url #5...')
],
<?php endif; ?>
完美的工作!!!