Content Rotation Script

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
DrateX
Forum Newbie
Posts: 1
Joined: Sat Apr 10, 2004 2:28 pm

Content Rotation Script

Post by DrateX »

Hi there,

Could anyone point me in the direction of where I could find a script to rotate content from my database to the homepage.

Basically each day with show a new letter on the mainpage which it is grabbing from our database. It will have a 24 hour cycle that goes through a set number of letters. So come midnight it will display a new letter for that entire day.

Anyone have any idea's or places for me to look? Having a real hard time finding anything :(

Thanks for any possible help you may have for me!
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Post by litebearer »

You might look into CRON. This runs "maintenance" at prest set times. You could have it run a script that chages what letter to run for that day.

example of the script via commenting:

// open text file "whatletter.txt".
// this file contains 2 lines
// line one is a number representing what letter is to used
// line two is a number representing the total number of letters available

// increment the number on line one by 1
// check to see that the result is NOT greater than the number on line two
// if it is greater than the total available reset it to 1
// save the file

In your page that displays the letter

// open the "whatletter.txt" file
// get the value of line one
// close the file
// use that variable to get abd display the appropriate letter
Post Reply