Page 1 of 1

Content Rotation Script

Posted: Sat Apr 10, 2004 2:28 pm
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!

Posted: Sat Apr 10, 2004 4:01 pm
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