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.

54 Comments to "Event Calendar"

Sparky July 30, 2014 at 11:49 pm | Reply

0

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

0

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)
matthew July 25, 2014 at 3:02 am | Reply

0

there is a bug, if we add or insert a date from 1-9 in a day , it is not highlighted.. help pls!!
Sparky July 30, 2014 at 9:23 pm

0

The script needs 2 digits in dates to work right. The simple solution is to have the program (if your adding them through a .php script) add a leading "0" to single digit dates.
anitha July 16, 2014 at 2:14 pm | Reply

0

Please see http://www.phpjabbers.com/free-event-calendar-script/ when you click on next month or previous month the event date of the current month disabled..
Sparky July 30, 2014 at 10:15 pm

0

That problem was corrected in comments from another member... I used it and it works!

in calendar.php, find"

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


and just under it, add this new line:

$cMonth = sprintf("%02d", $cMonth);
Dhivya July 7, 2014 at 11:19 am | Reply

0

good
maysam June 25, 2014 at 8:19 am | Reply

0

hi all

i want to ask can anyone help me to change in this script making it view line "No events to day" if there is no event added in database

thankx in advanced
Ravi Kumar May 2, 2014 at 8:41 am | Reply

0

Hi ,

What is the solution if some months starts on sunday and 1st date it not showing on the calender..?

Please Answer ...

Sparky July 30, 2014 at 10:20 pm

0

This is more of a quick fix, but it works. There are two changes... both in calendar.php This does make the first day of the calendar a Sunday, but it corrects the problem.

Change:
$startday = $thismonth['wday'] - 1; // 0 is for Sunday and as we want week to start on Mon we subtract 1


To:
$startday = $thismonth['wday']; // 0 is for Sunday and as we want week to start on Mon we subtract 1


---AND---

Change:
      <td class="wDays">M</td>
<td class="wDays">T</td>
<td class="wDays">W</td>
<td class="wDays">T</td>
<td class="wDays">F</td>
<td class="wDays">S</td>
<td class="wDays">S</td>


To:
     <td class="wDays">S</td>
<td class="wDays">M</td>
<td class="wDays">T</td>
<td class="wDays">W</td>
<td class="wDays">T</td>
<td class="wDays">F</td>
<td class="wDays">S</td>
adam April 12, 2014 at 10:36 am | Reply

+4

Having same problem, first day of some months not showing if its a Sunday, month starts at 02. How can we fix this?
DJ April 7, 2014 at 8:40 pm | Reply

+2

First day in June 2014 is not showing, because this day is in Sunday. How to fix that?
pankaj April 3, 2014 at 11:40 am | Reply

0

sry the exact link is www.phpjabbers.com/free-scripts/php-event-calendar/example-page.html


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 ~