Seven Day Rotation Script

B

benny

Does anyone know of a seven day rotation script I can get my grubby hands
on? I need it to change one page of my site everyday of the week.

I'm guessing this would be a Javascript.
 
L

Leif K-Brooks

benny said:
Does anyone know of a seven day rotation script I can get my grubby hands
on? I need it to change one page of my site everyday of the week.

Here's some untested PHP:
<?php
$days = array(
'Sun' => <<< END
It's Sunday!
END
,'Mon' => <<< END
It's Monday!
END
,'Tue' => <<< END
It's Tuesday!
END
,'Thu' => <<< END
It's Thursday!
END
,'Fri' => <<< END
It's Friday!
END
,'Sat' => <<< END
It's Saturday!
END
);
print $days[date('D')];
?>
I'm guessing this would be a Javascript.

You shouldn't use Javascript for anything essential like that.
 
T

Toby A Inkster

Leif said:
<?php
$days = array(
'Sun' => <<< END
It's Sunday!
END
,'Mon' => <<< END
It's Monday!
END
,'Tue' => <<< END
It's Tuesday!
END
,'Thu' => <<< END
It's Thursday!
END
,'Fri' => <<< END
It's Friday!
END
,'Sat' => <<< END
It's Saturday!
END
);
print $days[date('D')];
?>

<?= "It's " . date('l') . '!'; ?>
 
B

brucie

in post: <
benny said:
Does anyone know of a seven day rotation script I can get my grubby hands
on? I need it to change one page of my site everyday of the week.

use a bit of sexy PHP.

name your files by day of week. sunday.txt, monday.txt, tuesday.txt etc

to include the content of those files in your html document use:

<? include strtolower(date(l)).'.txt'; ?>

where you want the content of the files to appear.
I'm guessing this would be a Javascript.

don't use javascript
 
L

Leif K-Brooks

Toby said:
<?= "It's " . date('l') . '!'; ?>

Right, but the OP wanted to display something more than the week day
name. That was just an example with rather simple text for each day.
 
B

benny

Thanks everyone. I'll give it a go.
brucie said:
in post: <

use a bit of sexy PHP.

name your files by day of week. sunday.txt, monday.txt, tuesday.txt etc

to include the content of those files in your html document use:

<? include strtolower(date(l)).'.txt'; ?>

where you want the content of the files to appear.


don't use javascript
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top