Free web development scripts for the webmasterDevelopment Scripts

 Site Navigation
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 3 users online
 o Most users online: 67
 o Home
  o PHP
   o Image and Graphics
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Designer Baby Clothes
 o Advertise Here Make Money
 o Wedding Vendor Directory
 o Open Source Design
 o devnet
 o designplace
 o Free Wedding Websites
 o OxyScripts

Different Image for Day of Week (Rated 5)

Description:

This little code snippet shows how you would have a different image displayed for each different day of the week.

Put the images into the images directory called monday.jpg tueday.jpg etc etc etc
Any days you don't want to display a custom image, simply don't create an image for that day, and this will display the defaaultImage instead (which needs to exist)

Code starts here


<?PHP

// Images in the images directory name monday.jpg
// tuesday.jpg etc etc

$day = date('l');
if (
file_exists('images/'.$day.'.jpg')) {
echo
'<img src="images/'.$day.'.jpg">';
} else {
echo
'<img src="images/defaultImage.jpg">';
}

?>


Submitted by Devscripts on 24-02-2003 23:14


Rate This Script

User Contributed Comments

Registered Members login
© Copyright 2003 - Devscripts.net