A free christmas / advent calendar in PHP
A friend of mine wanted a christmas / advent calendar with 50ies pin-ups, and I couldn’t find one, so I scanned some and made an online calendar for her. As those are copyrighted, I will not reveal the pinups here, but instead offer you the script oft the calendar to use with your own pictures.
- See the “calendar in action”:http://icant.co.uk/articles/online-christmas-calendar/index.php
- See a “calendar for cheaters that works this month”:http://icant.co.uk/articles/online-christmas-calendar/indexnov.php
- Download “the script pack with demo images – 880KB Zip”:http://icant.co.uk/articles/online-christmas-calendar/xmascalendar.zip
- Download “the script pack without demo images – 92KB Zip”:http://icant.co.uk/articles/online-christmas-calendar/xmascalendar.zip
What does it do?
The script shows all the links of the different days pointing to a “not yet” image on days that are in the future, and points to the real image on days that are in the past or the current one. Clicking the image gets you back to the calendar.
How to alter the display?
Simply replace the images 1.jpg to 24.jpg in the “ups” folder with your images. 25.jpg is the “not yet available” image.
The page whole look+feel is defined in styles.css. The calendar is an unordered list with the ID “calendar”, the image is a DIV with the ID “pic” containing a link around an image.
The different day links are positioned via the ID l1 to l24 settings in the CSS.
You can change all these settings in the variables section of the xmascalendar.php file:
$pictureFolder='ups';
$month=12;
$clickableClass='done';
$calendarID='calendar';
$pictureID='pic';
Why in PHP and not in JavaScript?
This functionality could of course also be done in JavaScript, but that would make it easy to cheat by changing the computer’s date. You can of course cheat now by looking in the folder for the images themselves, but there are ways to prevent that server-side.
Yes, you could do that in AJAX with the PHP just doing the date checking, but frankly, I am too lazy right now :-)
Enjoy.


October 10th, 2007 at 12:18 pm
November 16th, 2005 at 6:21 pm
I like it, especially taking the following into consideration:
Site Title = “Wait Till I Come”
-> The “Wait Till I Come” – Calendar Script
November 19th, 2005 at 10:04 pm
Thanks for an easy and smooth calendar for christmas. :)
November 28th, 2005 at 1:47 am
Is there a way of doing this using .asp pages? With header & footer so it fits within my existing pages?
November 28th, 2005 at 11:00 am
Has anybody an idea where to get free xmas-pics? I´m not good in graphik-design :-(
Edit: Stock Exchange has a lot of free good pictures.
November 29th, 2005 at 9:24 pm
just right click an image and select 24.jpg
Edit Damn, you are the best hacker in the world! EVER! .htaccess does help against that.
December 1st, 2005 at 3:24 pm
Is there a way to make the 24th picture bigger than the rest?
December 2nd, 2005 at 3:09 pm
Excellent script, now in action on my site below – cheers :)
October 13th, 2006 at 8:20 am
How does the .htaccess code look for blocking the images for cheating?
October 15th, 2006 at 9:26 am
This would be exelent to use. But i dont know were to put what. I use vBulletin, could i pls get a step by step manual?
November 12th, 2006 at 2:31 pm
Is there anyway of putting a picture behind each image and then being able to click on that picture to take you to a different url with each window?
November 18th, 2006 at 11:53 am
Good script. But is that possible to make it show html files no images so i can get text on there and images. Ok i know my english skill is very bad and i don’t know do you understand my text but my problem is shortly how to get images off and convert them to text/html. I hope somebody understand my problem and can help
November 27th, 2006 at 1:58 pm
@author: nice script!
@ralla: you might want to try a calendar I wrote for my girlfriend, it supports html (no offense at the author of this one!). Check out ormus.info
January 1st, 2007 at 4:58 pm
Cool. Only WITHOUT a thorough How-to-use-that description (or a description at all) pretty useless.
Edit: I am so very sorry, next time I just write a 50 page booklet and charge 200 euro, OK?
January 1st, 2007 at 5:12 pm
When you don’t do it right, don’t do it at all. We are no pros here. Must be hard to figure
Edit: And who defines “right”? About 40 people used this calendar with these instructions. Other people need other instructions. I would be happy to allow all of them to add new instructions here (wikipedia style) but I surely don’t have the time to filter out all the spam attempts (and your emails look MIGHTY suspicious)
November 1st, 2008 at 10:25 pm
Hey,
sorry… my english is nor very good, but i`ll try it. ;)
Can i set for every day an different Link on every day?
Example:
Day 1: http://www.mydomain.com/2232.htm
Day 2: http://www.mydomain.com/2233.htm
and so on… ;)
thx for answering. :)
November 2nd, 2008 at 8:18 pm
Hi Chris,
thanks a lot for publishing this script, i spend hours online to find a calendar which I can customize for my friends, as a little xmas suprise. finally i found your site. It took me 2 minutes to upload the script, now i need just to find the right pictures on my harddrive.
Thanks again !
Christian