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.

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.

  • http://webjunkie.freehostia.com/?p=27 http://webjunkie.freehostia.com/?p=27

    [...] e Gedanken und Überlegungen zu lesen, kann einen fertigen Adventskalender HIER downloaden, oder nimmt halt den von Artmedic. Als “Datumsskript [...]

  • http://jasonmr.com/ JasonMR

    I like it, especially taking the following into consideration:
    Site Title = “Wait Till I Come”
    -> The “Wait Till I Come” – Calendar Script

  • Peter Blom

    Thanks for an easy and smooth calendar for christmas. :)

  • http://www.beaniekids.com Mark

    Is there a way of doing this using .asp pages? With header & footer so it fits within my existing pages?

  • http://www.snigles.de Joachim

    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.

  • http://urime doooh

    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.

  • http://forevermanutd.com Sam

    Is there a way to make the 24th picture bigger than the rest?

  • http://www.boinng.com Tim

    Excellent script, now in action on my site below – cheers :)

  • Martin

    How does the .htaccess code look for blocking the images for cheating?

  • Lottis

    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?

  • http://www.mumszone.co.uk TW

    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?

  • ralla

    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

  • http://www.ormus.info/ Ormus

    @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

  • Anna

    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?

  • Anna

    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)

  • Levi

    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. :)

  • http://www.woomla.com Christian

    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

blog comments powered by Disqus
Christian Heilmann's blog – Wait till I come! is the blog of Christian Heilmann , a developer evangelist living and working in London, England. Download vcard.

Feed me, Seymour: Entries (RSS) and Comments (RSS).