Thanks for your input, but I threw this together last night so you could see what I have in mind. This script does what I want, but not very well, and will bog down after adding a couple hundred or more content URLs. Can anyone come up with a better way of doing this? Thank you!
<?php
#################################################################
##
cycle-content.php - Dale A. Robbins 6-17-2015
##
This script does what I want, however it is composed in what
county folk in Tennessee call, "Outhouse Style": This means
It gets the job done... but it's messy, really stinks, and
isn't the best way of doing this!
##
#################################################################
// This will include a URL/file source into a page for x duration
// of days, and then cycle to the next content URL/file. When the
// last content inclusion expires, it will start over and repeat
// the cycle.
//
// Just put this script in a folder that has permissions to create
// and write files, it will take care of the rest.
// To test cycle, replace $timestamp in cycle.log with expired time
$NowTime = time();
// Create log file if cycle.log doesn't exist
if (!file_exists("cycle.log")) {
file_put_contents("cycle.log", "$NowTime|1");
}
// Get variables from cycle.log
$counter = file_get_contents("cycle.log");
list($timestamp, $count) = explode('|', $counter);
// Assign content URL's and DurationDays
list($content1, $DurationDays1) = explode('|', "http://www.foxnews.com|+1 day");
if($count == 1){
$DurationDays = $DurationDays1;
$content = $content1;
}
list($content2, $DurationDays2) = explode('|', "http://www.cnn.com|+2 days");
if($count == 2){
$DurationDays = $DurationDays2;
$content = $content2;
}
list($content3, $DurationDays3) = explode('|', "http://www.reuters.com|+3 days");
if($count == 3){
$DurationDays = $DurationDays3;
$content = $content3;
}
list($content4, $DurationDays4) = explode('|', "http://www.wsj.com|+4 days");
if($count == 4){
$DurationDays = $DurationDays4;
$content = $content4;
}
// Just in case my code goofs and $content becomes empty, it will display default $content1
if (empty($content)){
$content = $content1;
}
// If $NowTime time is +x $DurationDays past last included $timestamp,
// then cycle.log will log new $timestamp and $count + 1
if ($NowTime >= strtotime($DurationDays, $timestamp)) {
// When $count reaches max, start over from 0
if($count >= 4) {
$count = 0;
}
$count = $count + 1;
file_put_contents("cycle.log", "$NowTime|$count");
}
// Displayed content will cycle to the next $content URL when the $DurationDays expire
// URL is pulled into Iframe below for demo purposes
// echo $content;
?>
<div style="margin: 0 auto;width:800px;">
<? echo $content; ?>
<br />
<iframe src="<? echo $content; ?>" frameborder="0" name="content" width="800" height="500" scrolling="yes">
Your browser does not support frames.
</iframe>
</div>