logo
Active Calendar Code Examples

Preview current Active Calendar package examples (in a new window)

The following examples do not handle with the calendar layout. The layout (colors, fonts, cell width etc.) should be set in your CSS (see documentation). Please keep also in mind, that the following code does not produce a valid XHTML page. The generated calendar table is XHTML conform though.

Current month static calendar

<?php
require_once("activecalendar.php");
$cal = new activeCalendar();
echo $cal->showMonth();
?>
right
February 2010
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728

Current month calendar with date picker (year range: 2000-2010), month navigation and day links

<?php
require_once("activecalendar.php");
$myurl=$_SERVER['PHP_SELF']; // the links url is this page
$yearID=false; // init false to display current year
$monthID=false; // init false to display current month
$dayID=false; // init false to display current day
extract($_GET); // get the new values (if any) of $yearID,$monthID,$dayID
$cal = new activeCalendar($yearID,$monthID,$dayID);
$cal->enableMonthNav($myurl);
$cal->enableDatePicker(2000,2010,$myurl);
$cal->enableDayLinks($myurl);
echo $cal->showMonth();
?>
right
<< February 2010 >>
MonTueWedThuFriSatSun
1234567
891011121314
15161718192021
22232425262728

Month calendar (November 2007) with multiple 'event days' and 'event content'

<?php
require_once("activecalendar.php");
$cal = new activeCalendar("2007","11");
$cal->setEvent("2007","11","17","event"); // it will create a class="event"
$cal->setEvent("2007","11","7"); // it will also create a class="event" (default)
//The following will create a class="event" and an <a href="index.php">
$cal->setEvent("2007","11","20","event","index.php");
//The following will create an event content 'test1'
$cal->setEventContent("2007","11","12","test1");
//The following will create an event content 'test2' with an an <a href="index.php">
$cal->setEventContent("2007","11","13","test2","index.php");
//The following will create an event content 'test3'
//with an an <a href="index.php"> and class="event"

$cal->setEventContent("2007","11","14","test3","index.php","event");
//The following will create a block of events (26th to 30th)
for ($i=26;$i<=30;$i++) {
$cal->setEvent("2007","11",$i);
}
echo $cal->showMonth();
?>
right
November 2007
MonTueWedThuFriSatSun
1234
567891011
12
test1
13
test2
14
test3
15161718
19202122232425
2627282930
right Released version
1.2.0
right Version in development
1.2.1
popup calendar examples
code cleanup, documentation
right Subscription
right For new releases (freshmeat.net)
right Useful links
right microo.net
right Php.net
right Phpclasses.org
right Get Firefox!
Valid XHTML 1.0! Valid CSS!