View Full Version : How can I cycle .html files, for it to show one .html file a week?

02-28-2007, 12:32 AM
Hi there,

I am fairly new to the language PHP. I have been searching, and writing trying to get this script to work for about two weeks now to no prevail, and thats why I am asking you now. I started writing this script in Javascript, but I soon found out you cannot do SSI's.

Here is what I have so far, and hopefully it can give you an idea of what I want from it:



$week = date(W)
$weekfile = array("class23.html","class456.html"...);




Now I am trying to take that script, and make it to where it includes a new .html file each Sunday. If not Sunday then Monday wouldn't be half bad either.

But any help is much appreciated, and if your having trouble understanding my question just ask me to elaborate a little more, and I'll do my best. Thanks for any help you can provide!

02-28-2007, 12:47 AM
you're nearly there,

$week = date('W');

$file_index = $week - 1; //because weeks start at 1, arrays start at 0

$files = array('file1.html','file2.html'); //etc.

$week_file = $files[$file_index];

include $week_file;

02-28-2007, 01:05 AM
Wow, thank you so much. That script worked like a charm. I knew it had to be something simple like that, but I couldn't ever find what that simple thing was. But thank you so much!