I want my website to display a light blue theme during daytime browsing, and a dark gey theme during night browsing. I have generic code to discriminate for time based display, but I'm stuggling with how to indicate how to choose the appropriate directory, say, "day" for day images, and "night" for night images.
Both sets of image files will be named verbatim, just reside in different directories, and be accessed during differrent times of the day.
How do I indicate which folder to pull files from based on the time variable of "$h"?
Any help would be greatly appreciated ;o)
***** PLEASE USE THE PHP CODE TAG *****
Code: Select all
<?php
$h = date('G'); //set variable $h to the hour of the day
if ($h < 7) $img = 'fish.gif';
elseif ($h < 17) $img = 'images/frog.gif';
else $img = 'potato.gif';
echo '<img src="',$img,'" width="200" height="200" border="0" alt="Time Senstive Picture Display" />'; //display the appropriate image according to timestamp
?>