Jump to content

Recommended Posts

Posted

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.

Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...