2010-03-23 81 views
1
<link rel='stylesheet' type='text/css' href='fullcalendar/redmond/theme.css' /> 
<link rel='stylesheet' type='text/css' href='fullcalendar/fullcalendar.css' /> 
<script type='text/javascript' src='fullcalendar/jquery/jquery.js'></script> 
<script type='text/javascript' src='fullcalendar/jquery/ui.core.js'></script> 
<script type='text/javascript' src='fullcalendar/jquery/ui.draggable.js'></script> 
<script type='text/javascript' src='fullcalendar/jquery/ui.resizable.js'></script> 
<script type='text/javascript' src='fullcalendar/fullcalendar.min.js'></script> 

<script type='text/javascript'> 

$(document).ready(function() { 

    $('#calendar').fullCalendar({ 

    theme: true, 
    editable: false, 
    weekends: false, 
    allDaySlot: false, 
    allDayDefault: false, 
    slotMinutes: 15, 
    firstHour: 8, 
    minTime: 8, 
    maxTime: 17, 
    height: 600, 
    defaultView: 'agendaWeek', 

    events: "json_events.php", 

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

    }); 

}); 

</script> 

但是信息不會顯示在「agendaWeek」上。 任何人都可以告訴我我做錯了什麼。fullCalendar json with php in「agendaWeek」

我 「json_events.php」 的代碼是:

<?php 

$year = date('Y'); 
$month = date('m'); 

echo json_encode(array(

    array(
    'id' => 111, 
    'title' => "Event1", 
    'start' => "$year-$month-22 8:00", 
    'end' => "$year-$month-22 12:00", 
    'url' => "http://yahoo.com/" 
), 

    array(
    'id' => 222, 
    'title' => "Event2", 
    'start' => "$year-$month-22 14:00", 
    'end' => "$year-$month-22 16:00", 
    'url' => "http://yahoo.com/" 
) 

)); 

?> 

而且它提出了以下幾點:

[{"id":111,"title":"Event1","start":"2010-03-22 8:00","end":"2010-03-22 12:00","url":"http:\/\/yahoo.com\/"},{"id":222,"title":"Event2","start":"2010-03-22 14:00","end":"2010-03-22 16:00","url":"http:\/\/yahoo.com\/"}] 

請如果有人能幫助或推薦一個人幫我。

感謝, 丹尼斯

回答

2

你需要指定阿迪爲false,例如:

[ 
    { 
     "id": 111, 
     "title": "Event1", 
     "start": "2010-03-22 08:00", 
     "end": "2010-03-22 12:00", 
     "url": "http://yahoo.com/", 
     "allDay": false 
    }, 
    { 
     "id": 222, 
     "title": "Event2", 
     "start": "2010-03-22 14:00", 
     "end": "2010-03-22 16:00", 
     "url": "http://yahoo.com/", 
     "allDay": false 
    } 
] 

參見:Integrating jQuery fullcalendar into PHP website