Page 1 of 1

Loading Different Page Every Day

Posted: Sun Mar 18, 2007 4:34 pm
by stephan_pieri
Hello people.

Im new hear, and i have done a search in your HUGE forum, but unfortunately did not find the answer i am looking for.

What i Require.

I need a different page to be loaded every day. So on day 1, page1.htm/.php will load, and on day 2 page2.htm/php will load and so on.


What i have tried

nothing...it will get me nowhere lol.

Any help would be great guys, or if you know somewhere else which could help, im all ears.

Regards

Posted: Sun Mar 18, 2007 4:39 pm
by feyd
If you know the starting date, you can use some basic math to determine how many days it's been since that date (and time.)

Look for a post in the Code Snippets board by the user "printf" to find the math.

Posted: Sun Mar 18, 2007 4:44 pm
by stephan_pieri
Thankyou for the rapid response.

I have found the post you are refering to, but haven't got a clue how to put it all together...sorry

This is going to be my first PHP project so i am kinda an ameteur.

could you help?

Posted: Sun Mar 18, 2007 4:49 pm
by feyd
I'll gladly help, but don't mistake that for "writing the code for you."

The concept is to have the files to display stored somewhere, either in the script or in separate files you can include. The file you choose to display is based entirely on the number of days the math returns.

Start writing some code to test it out and see how it works. Use a shorter period of time so you can see it progress a bit faster.

Posted: Sun Mar 18, 2007 4:58 pm
by stephan_pieri
yeah. I want the files stored locally. Either in the same directory or in a separate folder.

Sorry. I mean i havent got a clue how the PHP code is to be structured, how i refer to pages, how i call them.

I looked at the post you suggested, and to be totally honest, the $n and $s and all of that means absolutely nothing to me.

I'm so sorry for asking this, and im hoping for this to be a quick project (a few weeks or a few months maximum)

Posted: Sun Mar 18, 2007 5:15 pm
by feyd
file_get_contents(), include(), among others may be of interest.

Posted: Sun Mar 18, 2007 5:23 pm
by stephan_pieri
right. Thats terrific news. Cheers for those two ...things.

I had a look at both, and i think the 'include' will work best.

Now i have to try and put a variable or something before it, then refer to the variable in inside the include.
So maybe the include code will look something like this;
include(getday".htm") where the variable be getday.

Or am i totally off target haha

Cheers once again for those suggestions, great help

Posted: Sun Mar 18, 2007 5:36 pm
by John Cartwright
Your almost there! You have the concept down, now just to familiarize yourself a bit with PHP.

If you havn't already take a look at these: variables and operators, along with the date() function to determine what file to to include()

Posted: Sun Mar 18, 2007 5:39 pm
by stephan_pieri
Great news. You two have been great help, but i am shattered and i gotta get up early so im going now. I will take a detailed look at the links you provided tomorrow, and hopefully i wont need your services on this subject.

Cheers guys

Posted: Sun Mar 18, 2007 6:28 pm
by John Cartwright
stephan_pieri wrote:Great news. You two have been great help, but i am shattered and i gotta get up early so im going now. I will take a detailed look at the links you provided tomorrow, and hopefully i wont need your services on this subject.

Cheers guys
Give it a try, post some code, and well help you as much as it takes.