Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Resizable BG plus time sensitive CSS Re: Resizable BG plus time sensitive CSS

#81716
TheDoc
Member

This isn’t tested, but you might be able to do something like this:

Code:
$hour = date(‘H’);

if ($hour >= 6 && <=9) {
echo(‘<link rel="stylesheet" href="sunrise.css" type="text/css" media="screen, projection" />’);
} elseif ($hour > 9 && < 20) {
echo(‘<link rel="stylesheet" href="day.css" type="text/css" media="screen, projection" />’);
} elseif ($hour >=20 && <=21) {
echo(‘<link rel="stylesheet" href="sunset.css" type="text/css" media="screen, projection" />’);
} else {
echo(‘<link rel="stylesheet" href="night.css" type="text/css" media="screen, projection" />’);
}

I’m not very proficient in PHP, so hopefully somebody can clean that one up for me.