Aqui hago la llamada de los datos por JSON
Código PHP:
<?php
require ('/config.php');
$link = mysql_connect("$hotsdb","$usuariodb","$clavedb") or die(mysql_error());
mysql_select_db('calendario',$link);
$query = "SELECT title, startdate, enddate FROM calendar";
$result = mysql_query($query) or die(mysql_error());
$arr = array();
while($row = mysql_fetch_assoc($result)){
$arr[] = $row;
}
echo json_encode($arr);
?>
Aca es la pagina donde muestro el calendario.
Código PHP:
<link href="fullcalendar-2.6.1/fullcalendar.css" rel='stylesheet' />
<script src="fullcalendar-2.6.1/lib/jquery.min.js"></script>
<script src="fullcalendar-2.6.1/lib/jquery-ui.custom.min.js"></script>
<script type="text/javascript" src="fullcalendar-2.6.1/lib/moment.min.js"></script>
<script type="text/javascript" src="fullcalendar-2.6.1/fullcalendar.min.js"></script>
<script>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var calendar = $('#calendar').fullCalendar({
//configure options for the calendar
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaWeek,agendaDay'
},
events: "/reservas.php",
editable: true,
defaultView: 'agendaWeek',
allDayDefault: false,
});
});
</script>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 13px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 400px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>