All pastes #73595 Raw Edit

Someone

public text v1 · immutable
#73595 ·published 2006-06-28 01:06 UTC
rendered paste body
<?php $d = 1;
    $wday = $firstwday;
    $firstweek = true;

    /*== loop through all the days of the month ==*/
    while ( $d <= $lastday)
    {

        /*== set up blank days for first week ==*/
        if ($firstweek) {

			if ($firstwday !==0){
		    echo "<tr><td colspan='$firstwday' bgcolor='#C0C0C0'><font size=2>&nbsp;</font></td>";
		    $firstweek = false;
		    }
		}


        /*== Sunday start week with <tr> ==*/
        if ($wday==0) { echo "<tr>"; }

        /*== check for event ==*/
        if ($d=10) {
        echo "<th align='center' bgcolor='#FFFF00'>";
        echo "<a href=\"?d=$d&m=$m&y=$y\"><font size='2'color='#000000'>$d</font></a>";
        echo "</th>\n";

        /*== Saturday end week with </tr> ==*/
        if ($wday==6) { echo "</tr>\n"; }

        $wday++;
        $wday = $wday % 7;
        $d++;
		} else {
				echo "<th align='center'>";
		        echo "<a href=\"?d=$d&m=$m&y=$y\"><font size='2'color='#000000'>$d</font></a>";
		        echo "</th>\n";

		        /*== Saturday end week with </tr> ==*/
		        if ($wday==6) { echo "</tr>\n"; }

		        $wday++;
		        $wday = $wday % 7;
        $d++;
}
    }
 if ($wday = $wday % 7)
    {$remainingDays = 7 - $wday;
	echo "<td colspan='$remainingDays' bgcolor='#C0C0C0'>&nbsp;</td>";}

echo "</tr></table>";

/*== end drawCalendar function ==*/
}