Constantly trying to improve my calendar script. Now I want it to also show week numbers.
Currently it's showing the current week number for all weeks. Any idea how I can correct this so it will show the week numbers correctly?
<?php
$num_of_days_in_month = date("t");
$current_day = date("j");
$start = date("N");
echo "<table border=1><tr><td colspan=7>" . strftime("%B %Y | %R %P") . "</td></tr>";
$wdays = array('w','Mon','Tue','Wed','Thu','Fri','Sat','Sun');
echo "<tr>";
foreach($wdays as $wday) {
echo "<td bgcolor=lightblue>" . $wday . "</td>";
}
echo "</tr><tr>";
if($start > 1) {
echo "<td colspan=".($start-1)."> </td>";
}
for($i=1; $i<=$num_of_days_in_month; $i++) {
$weekday = jddayofweek ( cal_to_jd(CAL_GREGORIAN, date("m"), $i, date("Y")), 0);
if($weekday == 1){
echo "</tr><tr><td bgcolor=orange>".strftime('%V',strtotime('today'))."</td>";
}
if($current_day==$i) {
echo "<td><b>".$i."</b></td>";
}
else {
echo "<td>".$i."</td>";
}
}
echo "</tr></table>";
?>