fullcalendar不发送启动参数

时间:2013-01-17 17:31:21

标签: php fullcalendar

我正在使用fullCalendar并且它现在正常运行..

我正在使用Firefox,我发现我的脚本发送到日历的请求是fullCalendar.html而没有event.php?start=....

这是我的配置脚本:

$(document).ready(function() {      
$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek,agendaDay'
    },

    firstDay:1,                         
    defaultEventMinutes: 30,            //default slot 30 minuti
    axisFormat: 'HH:mm',                //assi in agenda
    timeFormat: 'HH:mm',                //formato eventi        

    events: "fullCalendar/event.php"
  });
});

这是我的event.php:

<?
include("../database/config.php");

    if(isset($_GET["start"])){
        $data = date("Y-m-d", $_GET["start"]); //date("Y-m-d 00:00:00");    
    }else{
        $data = date("Y-m-d");  
    }

$data = $data." 00:00:00";

$query = "SELECT * FROM calendario WHERE 'start' > '$data'";
$result = mysql_query($query, $db);
    if ($result==FALSE) die("Errore nella composizione della query");

while ($row = mysql_fetch_array($result)){
    $id     = $row['id'];
    $titolo = $row['titolo'];
    $start  = $row['start'];
    $end    = $row['end'];
    $descr  = $row['descr'];
    $allDay = $row['allDay'];

    if ($allDay == "1"){    
        $events[] = array(
            'id' =>  "$id",
            'title' => "$titolo",
            'start' => "$start",
            'end' => "$end",
            'allDay' => true,
            'descr' => "$descr"
            );
    }else{
        $events[] = array(
            'id' =>  "$id",
            'title' => "$titolo",
            'start' => "$start",
            'end' => "$end",
            'allDay' => false,
            'descr' => "$descr"     
        );
    }
}
    echo json_encode($events);
?>

有人可以告诉我什么是错的吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

解决: 您必须在调用日历的页面的头部包含脚本..

<head>
  <link rel="stylesheet" type="text/css" href="fullCalendar/css/fullcalendar.css" />        
  <link rel="stylesheet" type="text/css" href="fullCalendar/css/jquery.alerts.css" />
  <link rel='stylesheet' type='text/css' href='fullCalendar/css/fullcalendar.print.css' media='print' />
  <script type="text/javascript" src="fullCalendar/js/fullcalendar.js"></script>
  <script type="text/javascript" src="fullCalendar/js/jquery.alerts.js"></script>           
  <script type="text/javascript" src="fullCalendar/js/myScript.js"></script>
 </head>

<div id="calendar"></div>