As we enter November, Christmas is well and truly on its way. We can all look forward to dark nights, turning on the lights and inevitable barrage of unwanted Christmas marketing dragging us into the festive spirit whether we choose to or not.
It’s this time of year when those in the website design industry are often briefed with the task of updating our client’s websites with details special offers and festive brand adjustment in the lead up to one of the busiest times of the year.
Ordering in Time for Christmas
E-commerce store owners will be faced with the task of packaging and processing more orders than usual and also have to negotiate any potential hold ups with the UK postal services. Proactive site owners will probably have already estimated the last available date at which an order can be made to guarantee arrival in time for the big day.
I’ve put together a simple PHP script to dynamically count down the amount of days that are remaining, along with a series of custom messages. All packaged in a neat little banner which can be easily added to your website or homepage.

Here’s the PHP…
The PHP code initially starts off with a condition which checks whether or not the date has passed, if not, it will output one of three messages depending on how close you are to the deadline.
<?php
$today = time();
//1. Enter Your Date Here...(default is 00:00 on 18th December 2010)
$event = mktime(0,0,0,12,18,date("Y"));
$difference = $event - $today;
if ($difference >= -86400)
{
$myevent = $event;
$countdown = round(($myevent - $today)/86400);
//2.a) Enter General Message for more than one day to go
if ($countdown > 1)
{
echo "$countdown days left";
}
//2.b) Enter Message for the Event Day
elseif (($myevent-$today) <= 0 && ($myevent-$today) >= -86400)
{
echo "Hurry, Order by 3pm Today";
}
//2.c) Enter Message for one day before Event Day
else
{
echo "Order by 3pm Tomorrow";
}
}
//2.d) Enter Message if the Date has Passed
else
{
echo "Sorry, Too Late!";
}
?>
Customising for your Website
Customising the php is easy, you just have to adjust the date and messages to your fit your requirements.
- 1. Enter your event date.
- 2. Output Messages a, b, c & d
Download the Files
Inside the Zip folder are the following contents which you are free to use and adjust as you please…
- 1. Well Commented PHP / HTML file
- 2. CSS Stylesheet
- 3. Background image JPG & PSD.



