Page 1 of 1

PHP Help?

Posted: Tue Mar 02, 2010 1:03 pm
by adilmarwat2004
I have two pic files one banner.jpeg and 2nd banner_chrismas.jpeg

I want to use these two jpeg files as banner in php file as that when the 25-Dec-2010 comes then the banner_chrismas.jpeg banner should be set as a banner for one day. and when the 26-December-2010 comes it may returned to banner.jpeg

How it is possible. I need you kind help in this problem


Adil

Re: PHP Help?

Posted: Tue Mar 02, 2010 1:09 pm
by AbraCadaver
Lot's of ways:

Code: Select all

if(date('mdY') == '12252010') {
  //echo christmas banner
} else {
  //echo other banner
}

Re: PHP Help?

Posted: Tue Mar 02, 2010 1:19 pm
by lshaw
If you want to check each year,

Code: Select all

 
$time=time(); //fetch the current time
$date=date("d/m",$time); //show the time value as 01/01
$christmas_day="25/12";//set christmas day, of any year
if($date==$christmas_day)
{
echo "<img src='christmas_banner.png />"; //echo cristmas banner
}
else
{
echo "<img src='normal_banner.png' />"; //echo normal banner
}
 

Re: PHP Help?

Posted: Tue Mar 02, 2010 1:35 pm
by adilmarwat2004
thank you so much