Example updated according to the comment by Shiraz Esat
This code basically changes the background color of your webpage
depending on the time. It will change every ten minutes.
All you need to do is add the following code into your HTML document.
Simple!!!
To use:
<BODY BGCOLOR=`<?php require("colourchange.php");print "$BGColour"); ?>`>
(don`t forget the colourchange.php file)
Peter Warnock wrote :1107
A more progessive application would be to include this in a style tag since html attributes are being depracated as we advance towards xhtml.
P C wrote :1108
You have an excellent idea. Your code, however, is hardcoded to change colors every 10 minutes.
If you would code the colours in an array, and use the mod function to determine which colour to use at what time (minutes, hours, day of the week, even months), then you could use the time interval as a user-definable parameter and give more possibilities.
To further the cause, if you want, you could even do interpolation between the two colours within the time interval so that the change would be a gradual one, if the user so desires.
The use of CSS, as suggested in a previous comment, would be a very wise choice in my opinion.
Thank you for contributing an excellent idea, and please keep up the good work.