Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Make sure that your PHP can output the f<a href="http://docs.jquery.com/Plugins/Calendar" rel="noreferrer">ollowing HTML code</a>:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function(){ $('#example').calendar(); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;link rel="stylesheet" href="http://dev.jquery.com/view/trunk/themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)"&gt; &lt;script src="http://dev.jquery.com/view/trunk/plugins/calendar/jquery-calendar.js"&gt;&lt;/script&gt; &lt;input type="text" id="example" value="Click inside me to see a calendar" style="width:300px;"/&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here's <a href="http://silverstripe.org/general-questions/show/264599" rel="noreferrer">a sample</a> how you can do it, by using json_encode:</p> <pre><code>$(document).ready(function() { $('#calendar').fullCalendar({ draggable: true, events: "json_events.php", eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + '(should probably update your database)'); }, loading: function(bool) { if (bool) $('#loading').show(); else $('#loading').hide(); } }); }); </code></pre> <p>And here's the PHP code:</p> <pre><code>&lt;?php $year = date('Y'); $month = date('m'); echo json_encode(array( array( 'id' =&gt; 1, 'title' =&gt; "Event1", 'start' =&gt; "$year-$month-10", 'url' =&gt; "http://yahoo.com/" ), array( 'id' =&gt; 2, 'title' =&gt; "Event2", 'start' =&gt; "$year-$month-20", 'end' =&gt; "$year-$month-22", 'url' =&gt; "http://yahoo.com/" ) )); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload