Hi!
I've found myself a finished calendar somewhere, now I would like to change the first day of week from sunday to monday, and since I'm a n00b, I would appreciate some pointers or something what in the following code is setting this.
<?php
if ($submit) {
if ($submit == "Prev") {
$month_now--;
} else {
$month_now++; }
$date = getdate(mktime(0,0,0,$month_now,1,$year_now));
} else {
$date = getdate();
}
$month_num = $date["mon"];
$month_name = $date["month"];
$year = $date["year"];
$date_today = getdate(mktime(0,0,0,$month_num,1,$year));
$first_week_day = $date_today["wday"];
$cont = true;
$today = 27;
while (($today <= 32) && ($cont)) {
$date_today = getdate(mktime(0,0,0,$month_num,$today,$year));
if ($date_today["mon"] != $month_num) {
$lastday = $today - 1;
$cont = false;
}
$today++;
}
echo"
<form action=\"content.php?sida=start\" method=\"post\" name=\"calendar\">
<input type=\"hidden\" name=\"month_now\" value=\"$month_num\" />
<input type=\"hidden\" name=\"year_now\" value=\"$year\" />
<table width=\"200\" align=\"center\" class=\"text\">
<tr><td><input type=\"submit\" name=\"submit\" value=\"Föregående\" class=\"form\" /></td>
<td align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Nästa\" class=\"form\" /></td>
</tr>
</table>
</form>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" align=\"center\" class=\"text\">
<tr>
<td class=\"title\" align=\"center\" valign=\"middle\">$month_name $year</td>
</tr>
<tr>
<td>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" align=\"center\" class=\"text\">
<tr align=\"center\" valign=\"bottom\">
<td class=\"daynames\">Måndag</td>
<td class=\"daynames\">Tisdag</td>
<td class=\"daynames\">Onsdag</td>
<td class=\"daynames\">Torsdag</td>
<td class=\"daynames\">Fredag</td>
<td class=\"daynames\">Lördag</td>
<td class=\"daynames\">Söndag</td>
</tr>";
$day = 1;
$wday = $first_week_day;
$firstweek = true;
while ( $day <= $lastday) {
if ($firstweek) {
echo "<tr align=\"left\" valign=\"top\">";
for ($i=1; $i<=$first_week_day; $i++) {
echo "<td></td>";
}
$firstweek = false;
}
if ($wday==0) {
echo "<tr align=\"left\" valign=\"top\">";
}
if ( intval($month_num) < 10) { $new_month_num = "0$month_num"; }
elseif (intval($month_num) >= 10) { $new_month_num = $month_num; }
if ( intval($day) < 10) { $new_day = "0$day"; }
elseif (intval($day) >= 10) { $new_day = $day; }
$link_date = "$year-$new_month_num-$new_day";
echo "<td class=\"day\"><a href=\"javascript:;\" onclick=\"openBrWindow('results.php?eventid=$link_date','Privacy','scrollbars=yes','700','500','true')\">$day</a></td>";
if ($wday==6) {
echo "</tr>\n";
}
$wday++;
$wday = $wday % 7;
$day++;
}
echo "
</tr>
</table>
</td>
</tr>
</table>";
?>
There's a lot of stuff that I do not understand, so my head starts spinning, but if anyone could just show me where to look i would probably figure it out myself.
/Mahlkav