Skip to content

Instantly share code, notes, and snippets.

@vishalbasnet23
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save vishalbasnet23/85c199b92b6208924a6b to your computer and use it in GitHub Desktop.

Select an option

Save vishalbasnet23/85c199b92b6208924a6b to your computer and use it in GitHub Desktop.
Simple Event Calender using jQuery and PHP
<!-- Enqueue fullcalender.io --->
<style>
#calendar {
max-width: 900px;
margin: 0 auto;
}
</style>
<?php
for ( $upcoming_events as $upcoming_event ) {
$upcoming_event_object = array(
'title' => $upcoming_event_name,
'start' => $upcoming_event_start_time,
'end' => $upcoming_event_end_time
);
array_push($event_calender_big_array, $upcoming_event_object);
}
$event_calender_json = json_encode($event_calender_big_array);
?>
<div id='calendar'></div>
<script>
jQuery(document).ready(function($) {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
defaultDate: "<?php echo date('F,Y');?>",
editable: false,
eventLimit: true, // allow "more" link when too many events
events: <?php echo $event_calender_json;?>
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment