Loading Different Page Every Day

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stephan_pieri
Forum Newbie
Posts: 5
Joined: Sun Mar 18, 2007 4:28 pm

Loading Different Page Every Day

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
stephan_pieri
Forum Newbie
Posts: 5
Joined: Sun Mar 18, 2007 4:28 pm

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
stephan_pieri
Forum Newbie
Posts: 5
Joined: Sun Mar 18, 2007 4:28 pm

Post 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)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

file_get_contents(), include(), among others may be of interest.
stephan_pieri
Forum Newbie
Posts: 5
Joined: Sun Mar 18, 2007 4:28 pm

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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()
stephan_pieri
Forum Newbie
Posts: 5
Joined: Sun Mar 18, 2007 4:28 pm

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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.
Post Reply