GeekyCorner

MySQL Table Search »

Event Calendar

Price: FREE Version: 1.0
The Event Calendar script is a free piece of PHP code to create an event calendar for you. Below is a description of the files used and what each one of them does.

calendar.css - external CSS file which lets you easily change the appearance. If you do not know how to locate the styles used for each calendar element please refer to "Inspect CSS styles using Chrome" video found here

calendar.js - all the JS functions used to scroll the calendar and the ajax calls made to load both the calendar and the events

calendar.php - this is the PHP script used to build and print the calendar widget

config.php - the file where mysql database login is defined

database.sql - mysql table structure

events.php - this is the PHP file which loads the events once you click on a date

example-page.html - a sample web page with embed calendar widget.

72 Comments to "Event Calendar"

Daniel October 23, 2014 at 4:01 pm | Reply

0

Hi,
Thanks for this great calendar. I was wondering if it would be possible to use timestamp for the date format in database. I tried something but nothing worked for me yet.
Dan
Daniel October 23, 2014 at 11:09 pm

0

unix timestamp
tajuboy1 October 20, 2014 at 7:08 pm | Reply

0

Some body should help how can i add events without go through phpmyadmin
Trilochan October 10, 2014 at 11:31 pm | Reply

+2

Hi, Thank you for this php event calender but I found some problem like when I added events in January 2015 it not showing in calender. please help me.
Sparky October 11, 2014 at 12:27 am

0

I would check the program you use to insert new events. I just added 3 new events directly through phpMyAdmin(sql) panel, and all showed up on the calendar perfectly. Check the database directly (phpMyAdmin) and make sure they are formatted correctly, and actually inserted. The date format is 2015-02-01. I hope this helps.
kabal8 October 6, 2014 at 1:47 pm | Reply

0

Hi,

at first, great praise!!
The calendar with the corrections is very nice.
It would be really great if you could popup the events in a separate window. (Example: alert(); )

Can anyone help me

Thanks and best regards

Kenny September 16, 2014 at 7:32 pm | Reply

0

hi.,.can anyone help me about this, i want to highlight also the current date.,.how can i do that?
Streak September 16, 2014 at 5:44 pm | Reply

0

Is it Possible to Highlight the Current Day? ex. if the today is 9/16/2014. the 16 in the calendar is highlighted. TIA
Sparky September 16, 2014 at 11:12 pm

+1

One thing to keep in mind, is if you highlight the current date with a background color like the event days, and there is an event on the current day, it would highlight as a current day, not current day AND event. A few simple changes there... but 20 minutes later, here is the 'Current Day' highlight code... (I have make a LOT of changes to the original code, so I hope this makes sense to you)

In calendar.css, add:
 #Calendar .today {
border:2px solid #000;
}


In calendar.php, there are 3 changes...
1-Change:
 (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y"); 


To:
 (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y");

// to highlight current day
$tDay = date("d");
$tMonth = date("m");
$tYear = date("Y");


2-Change:
 if ($current_day<10) $current_day = '0'.$current_day; 


To:
 if ($current_day<10) $current_day = '0'.$current_day;
if ($tDay == $current_day && $tMonth == $cMonth && $tYear == $cYear) { $tCurrent = "today";} else {$tCurrent = "";}


3-Change:
 if (isset($events[$cYear."-".$cMonth."-".$current_day]) && $events[$cYear."-".$cMonth."-".$current_day]<>'') {
$css='withevent';
$click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\"";
} else {
$css='noevent';
$click = '';
}


To:
 if (isset($events[$cYear."-".$cMonth."-".$current_day]) && $events[$cYear."-".$cMonth."-".$current_day]<>'') {
$css='withevent '.$tCurrent;
$click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\"";
} else {
$css='noevent '.$tCurrent;
$click = '';
}
Sparky September 16, 2014 at 11:21 pm

+2

Oh, I wish there was a preview, or edit post :( Anyways, the example CSS I gave will put a border around the 'current day', so it will be noticable, and still have a background highlight if there is an event on the same day. You can change the CSS however you want :)
Streak October 9, 2014 at 5:14 am

0

Thanks for This btw. i have been trying to show the events in pop up message upon clicking instead of echoing it at the bottom, but no luck here. is it possible to show it in pop up box?
Streak October 9, 2014 at 7:00 am

0

or displaying the events with their corresponding day without clicking is it possible? TIA
Abhay September 15, 2014 at 9:41 am | Reply

0

Not working with wamp server 2.5
i tried to import database file but not able to thn i created the database..
but not able to execute in netbeans 8.0
please kindly provide me the steps how to install n how to work upon it
m a beginner
John September 1, 2014 at 4:26 am | Reply

+1

Any ideas on how to make this code work in WordPress and show 6 months on screen?
Sparky July 30, 2014 at 11:49 pm | Reply

+6

Just as an option... when you change months, the event descriptions stay there... If you want them to be removed when you change months, in calendar.js... This will have it empty the 'events' div when you change months.

Change:
function LoadMonth(month, year) {
ajaxpage("calendar.php?month="+month+"&year="+year, "Calendar");
}


To:
function LoadMonth(month, year) {
ajaxpage("calendar.php?month="+month+"&year="+year, "Calendar");
document.getElementById('Events').innerHTML="";
}
Sparky July 30, 2014 at 10:28 pm | Reply

+5

There are two things that generate massive errors, if you look at your server logs, or turn on error reporting...

In calendar.php, near the top, add your default time zone...
date_default_timezone_set('America/Chicago');

Yours will most likely be different, so dont use 'America/Chicago'. Google the term 'date_default_timezone_set' and find out what yours is!

Also, for other errors,
Change:
if ($events[$cYear."-".$cMonth."-".$current_day]<>'') {

To:
if (isset($events[$cYear."-".$cMonth."-".$current_day]) && $events[$cYear."-".$cMonth."-".$current_day]<>'') {


Both work to get rid of PHP errors. I am using both. Thanks for the 'free' software that has been tested so well... :( (free does not mean offer it even though it does not work)


Please be polite and helpful and do not spam or offend others. We promise you will be treated the same way.

Log in your free account or if you still haven't joined you can create your free account now.

Posting tip:
if you use code in your comments please put it in these tags [php], [sql], [css], [js]
PHP code example: [php] echo date("Y-m-d"); [/php]

Thank you,
~ PHPJabbers team ~