Have ground it all down to a mixture of the above ideas. Still need to create an engine for the between dates; having a bit of a time working with timestamps and all. Something will come about, eventually. The following is working as expected.
PHP Code:
<?php
$today = date("Y-m-d");
function notBefore($startDate)
{
global $today;
return ($startDate < $today);
};
function notAfter($endDate)
{
global $today;
return ($endDate > $today);
};
function between($startDate,$endDate)
{
return (notBefore($startDate) && notAfter($endDate));
};
$weeks = array(
// ...
'w1205' => between('2012-01-01','2012-02-04'),
'w1206' => between('2012-01-08','2012-02-11'),
'w1207' => between('2012-01-15','2012-02-18'),
'w1208' => between('2012-01-22','2012-02-25'),
'w1209' => between('2012-01-29','2012-03-03'),
'w1210' => between('2012-02-05','2012-03-10'),
'w1211' => between('2012-02-12','2012-03-17'),
'w1212' => between('2012-02-19','2012-03-24'),
'w1213' => between('2012-02-26','2012-03-31')
// ...
);
function setRow($id)
{
global $weeks;
foreach($weeks as $key => $flag)
{
if($id == $key) return $flag;
};
return FALSE;
};
?>
The implementation is as follows:
PHP Code:
<?php
$cwd = getcwd();
...
$rSpan = " rowspan=\"2\"";
?>
...
<tbody>
<?php
chdir('includes');
if(setRow("w1205")){$pRow = $rSpan; include_once "w1205.inc"; if($pRow){iceView(4,6);};}; // *
if(setRow("w1206")){$pRow = $rSpan; include_once "w1206.inc"; if($pRow){iceView(7,7);};};
if(setRow("w1207")){$pRow = $rSpan; include_once "w1207.inc"; if($pRow){iceView(7,7);};};
if(setRow("w1208")){$pRow = $rSpan; include_once "w1208.inc"; if($pRow){iceView(4,7);};};
if(setRow("w1209")){$pRow = $rSpan; include_once "w1209.inc"; if($pRow){iceView(7,3);};};
if(setRow("w1210")){$pRow = ""; include_once "w1210.inc"; if($pRow) {iceView(0,7);};};
if(setRow("w1211")){$pRow = ""; include_once "w1211.inc"; if($pRow) {iceView(0,7);};};
if(setRow("w1212")){$pRow = ""; include_once "w1212.inc"; if($pRow) {iceView(0,7);};};
if(setRow("w1213")){$pRow = ""; include_once "w1213.inc"; if($pRow) {iceView(0,7);};};
chdir($cwd);
?>
</tbody>
...
* iceView() is discussed in this thread: preg_replace and resource drain
Until I get that engine written, the file will need maintenance. Eventually both the array in the library and the rows in the html template can be driven by one engine. Always more to do...
Thank you everyone for your input. Everything starts from a seed.