Hello again
Thank you so much for your responses, they really have helped me. In the end, the mention of Javascript and query strings got me thinking, and this is what I have come up with (the following is simplified and untested, but I just wanted to illustrate the kind of thing you made me think of):
Page One Blank Page with the following HTML contained in the <body> tag
<script type="text/javascript">
// <![CDATA[
[COLOR=seagreen]// Use Javascript to retrieve the current hour and minutes past the hour on
// the user's machine, putting the results into their own variables[/color]
var CurrentDate = new Date();
var CurrentHour = CurrentDate.getHours();
var CurrentMinute = CurrentDate.getMinutes();
[COLOR=seagreen]// Redirect the user to the main page constructing a query to carry the time across the two pages[/color]
window.location = "Page2.php?hour=" + CurrentHour + "&minute=" + CurrentMinute;
// ]]>
</script>
<noscript>Javascript support is needed for this first page</noscript>
Page Two The main page retrieved by the browser as, say, Page2.php?hour=12&minute=30
<?php
// Retrieve the hour and minute variables from the query string
$CurrentHour = $HTTP_GET_VARS["hour"];
$CurrentMinute = $HTTP_GET_VARS["minute"];
// Choose the appropriate colour scheme based on a 24 hour clock
if ($CurrentHour >= 22 && $CurrentHour <= 5)
{
$CurrentScheme = "nighttime";
}
elseif ($CurrentHour >= 6 && $CurrentHour <= 10)
{
$CurrentScheme = "sunrise";
}
elseif ($CurrentHour >= 11 && $CurrentHour <= 17)
{
$CurrentScheme = "midday";
}
elseif ($CurrentHour >= 18 && $CurrentHour <= 21)
{
$CurrentScheme = "sunset";
}
?>
Now all we need do is use the $CurrentScheme variable (and perhaps later on $CurrentHour and $CurrentMinute too) to produce the correct style, i.e.
<link href="scripts/style-<?php echo $CurrentScheme; ?>.css" media="screen" rel="stylesheet" type="text/css" />
PHP could also be used to append any links with the relevant query string in the second page, so that any further pages would have the time information needed, or, the time could be saved into a cookie file and retrieved by other pages. Calling the Javascript function again, later on, could also be used to keep the time updated.
This solution isn't perfect, but I think it's about as good as it's going to get without a dedicated PHP function, which, by the sounds of it, wouldn't be possible anyway. Should I think of anything else, or if this idea fails miserably, I'll be sure to post an update.
Thank you so much once more for all of your time and ideas, you're a great source of inspiration 🆒