I haven't changed over any of the date codes to using the mktime() yet, but here's my code so far. It seems like it works so far. I think I made it so that if the dates of the weekend happen to be on two seperate months, that it will just display the first month, which is fine.
Any suggestions?
<?
$Y = substr(date('Y'), 2, 2);
$m = date('m');
$M = date('M');
$D1 = date('d', time()-86400);
$D2 = date('d');
$newpdf = 'discussion.' . $Y . $m . '.' . $D1 . '-' . $D2 . '.pdf';
$found = "no";
if (is_file("/www".$newpdf)) {
echo '<img src="/g/link.gif" alt="" class="icon" /><a href="pdf/discussion/' . $newpdf . '" target="blank">Group Discussion Questions - ' . $M . ' ' . $D1 . '/' . $D2 . '</a>'."\n";
$found = "yes";
}
$i = 1;
while($found == "no") {
$D2 = date('d', time()-(86400 $i));
$D1 = date('d', time()-(86400 ($i + 1)));
$Y = substr(date('Y', time()-(86400 $i)), 2, 2);
$m = date('m', time()-(86400 ($i + 1)));
$M = date('M', time()-(86400 * $i));
$currentpdf = 'discussion.' . $Y . $m . '.' . $D1 . '-' . $D2 . '.pdf';
if (is_file("/www/pdf/discussion/".$currentpdf)) {
echo '<img src="/g/link.gif" alt="" class="icon" /><a href="pdf/discussion/' . $currentpdf . '" target="blank">Group Discussion Questions - ' . $M . ' ' . $D1 . '/' . $D2 . '</a>'."\n";
$found = "yes";
}
$i++;
}
?>