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.

75 Comments to "Event Calendar"

Dan November 24, 2014 at 4:08 pm | Reply

0

Hey all... I've got this working and hooked up, but I'm trying to add functionality... I'm trying to make it automatically display the events on the current day (if there are any) by default, without having to click anything. Here's what I've done...

On calendar.js, I added some lines at the bottom: (Note: I've made changes to the directory and file names, but all are still functioning properly)

function LoadMonth(month, year) {
ajaxpage("admin/event_calendar.php?month="+month+"&year="+year, "Calendar")
}
function LoadEvents(date) {
ajaxpage("admin/cal_events.php?date="+date, "Events")
}
function LoadToday(date) {
ajaxpage("admin/current_date.php", "Today")
}

LoadMonth();
LoadToday();


My current_date.php file loads the current date just the came as the event.php file does, and when I access current_date.php directly, it works fine in displaying the events that are registered for that specific date.

When I load the calendar, it does not load the events for that day. It loads up like normal and seemingly ignores the LoadToday() command.

I know little to none about javascript, so perhaps I've missed something altogether. Any help?

Thanks,
Dan
caleb November 21, 2014 at 9:31 am | Reply

0

Not working for 2015 events
can scrolling to new date be faster
AbdulRauf November 5, 2014 at 9:20 am | Reply

+1

Hi.
how can add events to 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

+3

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

+2

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


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 ~