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 |