jsarber Posted November 16, 2009 Report Posted November 16, 2009 I know I've done this before on a past website but for the life of me, I cannot remember how I did it. I would like to schedule a small portion of content on the site to change during one hour each day. Any help would be greatly appreciated. Quote
jlhaslip Posted November 16, 2009 Report Posted November 16, 2009 php scripting can do that. Use the date/time functions and echo the contents according to the time of day. Quote
falkencreative Posted November 16, 2009 Report Posted November 16, 2009 You should also be able to do this with javascript (though obviously it is dependent on having Javascript enabled): http://www.tizag.com/javascriptT/javascriptdate.php Quote
jsarber Posted November 16, 2009 Author Report Posted November 16, 2009 I don't suppose someone could point me in the direction of a php/time/date/echo tutorial? Quote
jsarber Posted November 17, 2009 Author Report Posted November 17, 2009 Ok. I've went digging through my archives of past website files and found the code I used: <?php $dir = 'dbi/'; $new_file = $dir.date('d-m-y').'.php'; if(file_exists($new_file)) { /* if there's a file matching today's date, include it */ include $new_file; } else { /* include a random file if there's no file for today */ $files = glob($dir.'*.php'); include $files[rand(0, count($files)-1)]; } ?> How can I change this to schedule according to both date and time? Is this possible? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.