Show something based on date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
theblob
Forum Newbie
Posts: 1
Joined: Sun Nov 23, 2003 4:01 pm

Show something based on date

Post by theblob »

I have bits of php scatered on my site, and I was wondering how to show an image and text on a certain date. Any help would be good; thanks.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

not sure what you mean though. what dates are you talking about? How are you storing the dates, and how are they set ? are you storing them in a database? please be more descriptive of your issue, and maybe post some code for us to go with.
seeker2921
Forum Contributor
Posts: 120
Joined: Sat Mar 22, 2003 7:10 pm
Location: Wiesbaden Germany
Contact:

Post by seeker2921 »

This is the code I use on my site to show an image with the date on the top of my page, Im use you can use it and custmize it for your needs..

Code: Select all

<?
$monday=("/htm/images/date/monday.gif");
$tuesday=("/htm/images/date/tuesday.gif");
$wendnesday=("/htm/images/date/wednesday.gif");
$thursday=("/htm/images/date/thursday.gif");
$friday=("/htm/images/date/friday.gif");
$saturday=("/htm/images/date/saturday.gif");
$sunday=("/htm/images/date/sunday.gif");
$zone=("pst");

$img_date=date("w");
$time=date(" h:i a ");
$date=date("F j, Y");
 if($img_date=="0")
 {
 print("<img src="$sunday"> ".$date.$time.$zone);
 }
 if($img_date=="1")
 {
 print("<img src="$monday"> ".$date.$time.$zone);
 }
 if($img_date=="2")
 {
 print("<img src="$tuesday"> ".$date.$time.$zone);
 }
 if($img_date=="3")
 {
 print("<img src="$wednesday"> ".$date.$time.$zone);
 }
 if($img_date=="4")
 {
 print("<img src="$thursday"> ".$date.$time.$zone);
 }
 if($img_date=="5")
 {
 print("<img src="$friday"> ".$date.$time.$zone);
 }
 if($img_date=="6")
 {
 print("<img src="$saturday"> ".$date.$time.$zone);
 }
?>
Post Reply