Hi,
is there a script (preferably in PHP) which will change a pages contents (or redirect) depending upon the day and time.
Say from Friday 5PM till Sunday noon different content will be shown?
Thanks
Sam
Dynamic Page Script?microsoft access
In PHP this is possible.
First use PHPs Date function to get the date
$day = date("N");
// Where N equals numeric day of the week, e.g. Monday = 1
$time = date("H");
// Where H equals 24 hour style time of day in hours
Then the following code to show content
if($day %26gt; 5){
// So far we know it's Friday or later we can see if we show the content
if($day = 5) %26amp;%26amp; ($time %26gt; 16){
// The day is friday and it's later than 4pm so show content
[[ Put your weekend content here ]]
}else{
// We know it's not Friday but we know it is the weekend so we don't need to check the time, show content
[[ Put your weekend content here ]]
}
}else{
// It's not Friday or later so we don't show the content for the weekend
[[ Put normal content here ]]
}
This is untested but should work, though a syntax error may appear, if so please contact me via my yahoo username at yahoo dot co dot uk
Dynamic Page Script?windows mobile 6 internet explorer
A javascript could even be written on the host site's index page that would accomplish this...
%26lt;?php
if(time() %26gt; '17:00:00')
{echo 'It\'s after 5'; }
else
{echo 'It\'s not after 5'; }
?%26gt;
No comments:
Post a Comment