是否可以在最新版本的完整日历上显示开始和结束时间?我使用json来提供数据,这很好用:
// Initializes a container array for all of the calendar events
$jsonArray = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id = $row['HolidayType'];
$title = $row['name'];
$start = $row['start'];
$end = $row['end'];
// Stores each database record to an array
$buildjson = array('title' => "$title", 'start' => "$start", 'end' => "$end", 'allDay' => false);
// Adds each array into the container array
array_push($jsonArray, $buildjson);
}
echo json_encode($jsonArray);在我的数据库中,我添加了2列,start_time和end_time,如果我将它们添加到上面的代码中,它不会拉出时间和页面错误?
// Initializes a container array for all of the calendar events
$jsonArray = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id = $row['HolidayType'];
$title = $row['name'];
$start = $row['start'];
$end = $row['end'];
$start_time = $row['start_time'];
$end_time = $row['end_time'];
// Stores each database record to an array
$buildjson = array(
'title' => "$title",
'start' => "$start",
'end' => "$end",
'start_time' => "$start_time",
'end_time' => "$end_time",
'allDay' => false);
// Adds each array into the container array
array_push($jsonArray, $buildjson);
}
echo json_encode($jsonArray);你知道我如何通过json,使用start_tim,end_time来拉取时间,显然是不正确的?
谢谢
发布于 2012-03-08 06:47:30
Gary,你的开始和结束参数不包含时间吗?开箱即用的Fulcalendar将使用默认的timeFormat:'h(:mm)t‘显示开始时间,例如,如果你在FulCalendar的网站上查看示例演示,它会显示为7p或10:30a。您确实需要使用allDay:false才会发生这种情况。
至于同时显示开始日期和结束日期。我找不到任何可以直接做到这一点的东西。我最终修改了代码(在第4700行附近的某个地方显示月份,并让事件块像这样显示solething……
07:00 title 10:30
如果开始参数和结束参数不包含时间,则应该能够通过使用event.start_time和event.end_time在数组中使用额外的值,但同样需要修改主FulCalendar.js
如果您需要更多信息,请让我知道。
https://stackoverflow.com/questions/9605722
复制相似问题