Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying content each day in order 2

Status
Not open for further replies.

cian

Technical User
Oct 11, 2001
1,383
Hi!

My problem is this. I have over 120 pages of a 'tutorial' and I want to display them in an exact order (from 1 to 120) showing a new tutorial each day. They are in separate files (I could merge into a single file if required) not in a database.
After 120 days the process should start again.

Can anyone give me a clue where I should start? Any particular functions I should be looking for? I really have no idea where I should be starting.


Thanks in advance
E

Tip: Don't use "Click here" as link text. Click here to find out why.
 
Loader script:
1. Define a start date
2. Define the number of pages
3. Calcualte the current day's page
4. use the header() command to redirect to that page
5. When the number of the day > number of pages set a new start date

You can save the start date in a plain file. Open it (look at fopen()), read it, and use the date/time functions to get the number of days.

I completely agree: click here is deplorably bad.
 
Thanks DRJ478!
This sounds like a challenge for my limited php skills but at least I know the direction to go in.

Thanks again, much appreciated!!




Tip: Don't use "Click here" as link text. Click here to find out why.
 
You can move the tutorials in a /tut/ folder, then you modify a dirlist script to fill an array with the dirlist contents.

then you calculate, like drj478 said above, the tutorial of the day.. and echo header() with location to the $dirlist[$day]

I hope this makes sense to you..

1. calc like drj478 said
2. make array with content of the /tut/ folder
3. use php and header() location -> array[key], where key == tut of the day.

how to calc tut of the day?
I guess you define a start-date and find the datediff from today and the startdate.

You then wrap that (like again, drj478 said), in an if sentence..

Code:
if ($days_since_start <= $num_of_tuts)
  {
    $url = "/tut/" . $dirlist[$days_since_start];

    header("HTTP/1.1 301 Moved Permanently");
    header("Location: ".$url);
    header("Connection: close"); 
  }
else
  {
    // generate new start date, as again, drj478 said.
  }

ps. this basically is what drj478 said, only I had one small addition. (the dirlist way)..

Olav Alexander Mjelde
Admin & Webmaster
 
Thanks DaButcher, that's a big help.

Thanks to both!

Tip: Don't use "Click here" as link text. Click here to find out why.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top