Hi,
This is a calendar script and I should be getting a regular calendar with days, months and years but instead of getting the result of all the days, months and years, I am getting only ONE DAY (Fri - Aug 1st/2003 - week 31).
I already went thru the routine many times and I can't find the problem....Does anybody have a clue where the problem is located?
=============================================
<?php
print "<head><STYLE>
.calendar {border-width=1;border-style=solid;}
.calcell {border-width=1;border-style=solid;}
.contentcell {border-width=1;border-style=solid;}
.dayCell {border-width=1;border-style=solid;}
.dayHeader {border-width=1;border-style=solid;}
.weekOfYear {border-width=1;border-style=solid;}
</STYLE></head>";
function getDaysInMonth($thisYear,$thisMonth)
{
$date=getdate(mktime(0,0,0,$thisMonth+1,0,$thisYear));
return $date["mday"]+1;
}
function getArrayMonth($datetime)
{
$dateArray = getdate($datetime);
$mon = $dateArray['mon'];
$year = $dateArray['year'];
$numDaysInMonth = getDaysInMonth($year,$mon);
$week=1;
for ($i=1; $i < $numDaysInMonth;$i++)
{
$timestamp = mktime(0,0,0,$mon,$i,$year);
$dateArray = getdate($timestamp);
$result[$i]=array('wday'=>$dateArray['wday'],'week'=>$week,'timestamp'=>$timestamp);
if ($dateArray['wday']==6)
{
$week=$week+1;
}
return $result;
}
}
function getHTMLCalendar($datetime)
{
$arrayCalendar = getArrayMonth($datetime);
print "<TABLE class=calendar<>\n";
$week=1;
print "<tr>";
for ($start=1;$start<=$arrayCalendar[1]['wday']; $start=$start+1)
print "<td></td>";
$lastday=1;
foreach ($arrayCalendar as $day => $result) {
if ($week!=$result['week'])
{
print "<td class=weekOfYear>Week " . date("W", $result['timestamp']) . "</td>";
$week=$result['week'];
}
print "<td class=dayCell>";
print "<table>";
print "<tr><td class=dayHeader>";
print date("D M j Y", $result['timestamp']);
print "</td></tr>";
function getContent($timestamp)
{
@file_get_contents("events/".$timestamp.".txt");
}
print "<tr><td><div class=contentCell>";
$cellContent= getContent($result['timestamp']);
if ($cellContent=="")
print "<a href=addEvent.php?timestamp=".$result['timestamp'].">Add Event</a>";
else
{
print "style='overflow:scroll;'>";
print "<a href=addEvent.php?timestamp=".$result['timestamp']."&eventText=".urlencode($cellContent).">".$cellContent;
}
print "</div></td></tr>";
print "</table>";
print "</td>\n";
$lastday = $day;
}
for ($start=1;$start<=6-$arrayCalendar[$lastday]['wday']; $start=$start+1)
print "<td></td>";
print "<td class=weekOfYear>Week " . date("W", $arrayCalendar[$lastday]['timestamp'])." </td>";
$week=$result['week'];
print "</tr>\n";
print "</TABLE>\n";
}
getHTMLCalendar(time());
?>
==============================================
Tks