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?

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...