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.
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.
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
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?
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?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now