Forum Moderators: coopster
I'm looking for a script that will switch out gif images depending on the date. For example, November through December, the site will show a Christmas image. Then mid January though Feb 14th, a Valentine's day image. Can anyone recommend a script? I tried searching for one but I must be using the wrong keywords.
TIA,
Hope
All you have to do is determine the current date and then use a control structure [php.net] to choose the correct image.
You could start with something like this and work with it until you get what you want. Along the way, you'll pick up some programming skills!
<?php
$date = date('md'); //mmdd format
switch (true)
{
case ($date > '1031'):
// November 1 - December 31
$image = 'nov-dec.gif';
break;
case ($date > '0731'):
// July 31 - October 31
$image = 'nov-dec.gif';
break;
default:
$image = 'default.gif';
}
print $image;