EasyPhpEventCalendar Class

The EasyPhpEventCalendar class allows you to display a clean, easy to integrate, easy to use and easy to navigate event calendar for your website. It will display events up to 12 months in the future. The event itself can be styled and formatted as you wish by providing the appropriate HTML markup. The event calendar is cross-browser compatible.

You may use this class for your personal or open-source projects as long as you do not charge a fee. If you develop websites for a fee or if you plan to use this class in a commercial package, please purchase the EasyPhpEventCalendarPro class from our shop.

Download now

 
 
Jan
Feb
Mar
Apr
May
Jun
February 2010
SunMonTueWedThuFriSat
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 123456
 
Jul
Aug
Sep
Oct
Nov
Dec
 


Purchase the Pro script for your website!
The EasyPhpEventCalendar PHP script is XHTML 1.0 strict compliant!
xhtml xhtml


Getting started:

1. Download the class, unzip it and upload it to your webserver
2. Open the example page located in the directory 'example/example.php'

The most simple script would be:

<?php
include_once('easyphpeventcalendar.class.php');
$calendar = new easyphpeventcalendar;
$calendar -> Gfxurl     = '../gfx';
$calendar -> Events[] = array('20091225','Christmasday 2009');
$calendar -> CreateEventCalendar();
?>

This would create the event calendar with only one event on December the 25th 2009. You can add as many events as you would like. You can use full html markup to enhance the appearance of the events. You can add events manually as shown above, read events from files as shown in the example below or read them from a database. How you manage your events is up to you, the class is designed to display them only.

<?php
$eventslocation='events'; 
if ($dir=@opendir($eventslocation)) {
    while ($file=@readdir($dir)) {
        if (@strtolower(substr($file,-3))=='txt') {
            if ($fp=@fopen("$eventslocation/".$file,'r+')) {
                $text=fread($fp,filesize("$eventslocation/".$file));
                @fclose($fp);
                $calendar -> Events[] = array(substr($file,0,8),$text);
            }  
        }
    }
}
?>

The above example expects a text file for each event to be located in a directory called 'events'. The filenames of the events are in the format: 'YYYYMMDD.txt'.



API reference:

Initialize the class:

include_once('easyphpeventcalendar.class.php');
$calendar = new easyphpeventcalendar;


Options:

$calendar -> Gfxurl      = (string)      // Path to the class gfx directory
$calendar -> Days        = (array)       // Days of the week in other langauge
                                            [0]: (string) Sunday
                                            [1]: (string) Monday
                                            [2]: (string) Tuesday
                                            [3]: (string) Wednesday
                                            [4]: (string) Thursday
                                            [5]: (string) Friday
                                            [6]: (string) Saturday
$calendar -> Months      = (array)       // Months of the year in other language
                                            [0]:  (string) January
                                            [1]:  (string) February
                                            [2]:  (string) March
                                            [3]:  (string) April
                                            [4]:  (string) May
                                            [5]:  (string) June
                                            [6]:  (string) July
                                            [7]:  (string) August
                                            [8]:  (string) September
                                            [9]:  (string) October
                                            [10]: (string) November
                                            [11]: (string) December
$calendar -> Events[]    = (array)       // Add new events 
                                            [0]: (array) [0](string)
                                                         Date of event in format YYYYMMDD
                                                         [1] (string) 
                                                         Event description as text/html
                                            [x]: (array) [0] (string)
                                                         Date of event in format YYYYMMDD
                                                         [1] (string)
                                                         Event description as text/html


AttachmentSizeHitsLast download
easyphpeventcalendar.zip11.62 KB10926 hours 14 min ago