Ajax Event Calendar Support Product Page

Answered

Problem getting event calendar to display

Asked 17 Aug 2011 11:09:14
1
has this question
17 Aug 2011 11:09:14 Phil Boyle posted:
Followed the setup instructions for the event calendar.
Inserted event into database okay but didn't show up in calendar.

When it says start and stop use database default date and time how do I do this and is this the reason why my calendar isn't showing anything.

Here is a link to my basic insert event page trickstar.co.nz/newNCS/cms/add_calendar.php and calendar display page and just in case the calendar_get_events1.php code is displayed below.
<?php
/*
table="[eventcalendartbl]"
title="[eTitle]"
start="[eStartTime]"
stop="[eStopTime]"
description="[eDesc]"
type="[eType]"
link="[[eLink] AS link]"
event_id="[eKey]"
db_type="mssql"
*/
require_once('../ScriptLibrary/xmlrpc.inc');
require_once('../ScriptLibrary/jsonrpc.inc');
require_once('../ScriptLibrary/json_extension_api.inc');
require_once('../Connections/dbConn.php');
if (!isset($_GET['start']))
{
header("HTTP/1.0 400 Bad Request";
echo "Start is required";
exit();
}
else if (!is_numeric($_GET['start']))
{
header("HTTP/1.0 400 Bad Request";
echo "Start should be a numeric value";
exit();
}
else if (!isset($_GET['stop']))
{
header("HTTP/1.0 400 Bad Request";
echo "Stop is required";
exit();
}
else if (!is_numeric($_GET['stop']))
{
header("HTTP/1.0 400 Bad Request";
echo "Stop should be a numeric value";
exit();
}
else
{
$query_start = intval($_GET['start']);
$query_stop = intval($_GET['stop']);
mysql_select_db($database_dbConn, $dbConn);
$query_events = sprintf('SELECT [eTitle] AS title, [eStartTime] AS start, [eStopTime] AS stop , [eDesc] AS description, [eType] AS type, [eKey] AS event_id FROM [eventcalendartbl] WHERE [eStartTime] <= %1$d AND ([eStopTime] >= %2$d OR (ISNULL([eStopTime]) AND [eStartTime] >= %2$d))',$query_stop, $query_start);
$events_set = mysql_query($query_events, $dbConn) or die(mysql_error());
$result_array = array();
while ($row = mysql_fetch_assoc($events_set))
{
$result_array[] = $row;
}
header("Cache-Control: no-cache";
if(isset($_GET['callback']))
{
echo $_GET['callback']."(".json_encode($result_array).";";
}
else
{
echo json_encode($result_array);
}
}
?>

And here is the code for showing the event calendar.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="Styles/dmx_ajaxcalendar.css" />
<script type="text/javascript" src="ScriptLibrary/jquery-latest.pack.js"></script>
<script type="text/javascript" src="ScriptLibrary/dmx_events_calendar.js"></script>
<script type="text/javascript" src="ScriptLibrary/jquery.jsonp-1.1.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="Styles/dmxAjaxCalendar/dark_black/dark_black.css" />
<script type="text/javascript" src="ScriptLibrary/calendar_translation_en.js"></script>
</head>

<body>
<div class="dmx_ajax_event_calendar dark_black" id="dmxAjaxCalendar1" style="width:800px;"></div>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function()
{
jQuery("#dmxAjaxCalendar1".dmxAjaxCalendar(
{id:"dmxAjaxCalendar1", allowed_display_types:[true, true, true, true], events_type:[{number:0, name:"Type 1", color:"#000000", background_color:"#FFD700", border_color:"#FFD700"}, {number:1, name:"Type 2", color:"#000000", background_color:"#98FB98", border_color:"#98FB98"}, {number:2, name:"Type 3", color:"#000000", background_color:"#4169E1", border_color:"#4169E1"}, {number:3, name:"Type 4", color:"#000000", background_color:"#98B6FC", border_color:"#98B6FC"}, {number:4, name:"Type 5", color:"#000000", background_color:"#A78EC0", border_color:"#A78EC0"}, {number:5, name:"Type 6", color:"#000000", background_color:"#FF8C00", border_color:"#FF8C00"}, {number:6, name:"Type 7", color:"#000000", background_color:"#A52A2A", border_color:"#C04545"}, {number:7, name:"Type 8", color:"#000000", background_color:"#FFC0CB", border_color:"#FFC0CB"}, {number:8, name:"Type 9", color:"#000000", background_color:"#008000", border_color:"#008000"}], google_feeds:[], ajax_feeds:[{url:"calendar_ajax/calendar_get_events1.php"}, {url:"calendar_ajax/calendar_get_events1.php"}], date_display_type:1, use_working_hours:true, time_conversion:"user"}
);
}
);
// ]]>
</script>
</body>
</html>

I know I'm probably just missing something.
Thanks for your time
Phil

Replies

Replied 23 Aug 2011 10:39:54
23 Aug 2011 10:39:54 Phil Boyle replied:
Hi
Can anybody help. I have run firebug on the calendar test page here trickstar.co.nz/newncs/calendar.php and it produced this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Untitled Document</title>
<link href="Styles/dmx_ajaxcalendar.css" type="text/css" rel="stylesheet">
<link href="Styles/dmxAjaxCalendar/apple_dark/apple_dark.css" type="text/css" rel="stylesheet">
<script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript">
<script src="ScriptLibrary/dmx_events_calendar.js" type="text/javascript">
<script src="ScriptLibrary/jquery.jsonp-1.1.1.min.js" type="text/javascript">
<script src="ScriptLibrary/calendar_translation_en.js" type="text/javascript">
<style id="dmxAjaxCalendar1_ss" type="text/css">
</head>
<body>
<div id="dmxAjaxCalendar1" class="dmx_ajax_event_calendar apple_dark" style="width:800px;">
<script type="text/javascript">
</body>
</html>

Deadline looming, any help appreciated.
Replied 25 Aug 2011 00:36:54
25 Aug 2011 00:36:54 Phil Boyle replied:
I've finally got it working. I didn't realise when I was making my table that the event type was entered into the database as a number. So when I tried the create new table function and got it working I found out where I'd been going wrong. I don't think this is mentioned in the manual the only database help was when it mentions that the event calendar uses the date function of the database. And I read the manual several times.

Now the basics are sorted ..time for more.
Replied 25 Aug 2011 02:23:54
25 Aug 2011 02:23:54 Phil Boyle replied:
Now it's not working. It isn't displaying any events and this time it isn't adding the correct type to the database record - unless I leave the types unaltered and just type in numbers from 0-8 . This is very frustrating.
Replied 25 Aug 2011 02:49:44
25 Aug 2011 02:49:44 Phil Boyle replied:
I found the problem. When I redid my event calendar the generated file get_calendar_events1.php was producing this code /*
table="`eventcalendar`"
title="`event_title`"
start="`start`"
stop="`stop`"
description="`description`"
type="`type`"
link="``link``"
event_id="`event_id`"
db_type="mysql"
*/

instead of what I think is the correct version this:
/*
table="eventcalendar"
title="event_title"
start="start"
stop="stop"
description="description"
type="`type`"
link="link"
event_id="event_id"
db_type="mysql"
*/

After I removed all the extra quote marks it worked.
Replied 13 Jul 2013 17:46:29
13 Jul 2013 17:46:29 S A M replied:
Mine was related to lighbox. When I removed references to lightbox, the calendar events showed up. Not sure why, though, because the two are supposed to be compatible.
Replied 22 Jul 2013 11:27:32
22 Jul 2013 11:27:32 S A M replied:
UPDATE: Turns out in my case the server my client's site was hosted on used an older version of PHP. A new release of the Ajax Event Calendar fixed the issue.

Reply to this topic