Hello, here is my problem: [php]for($i=1, $c=1, $t=date(‘j’), $m=date(‘m’), $y=date(‘Y’);$c<=$this->_daysInMonth; ++$i)
{
/*
* Apply a “fill” class to the boxes occurring before
* the first of the month
/
$class = $i<=$this->_startDay ? “fill” : NULL;
/
* Add a “today” class if the current date matches
* the current date
*/
if ( $c==$t && $m==$this->_m && $y==$this->_y )
{
$class = "today";
}
/*
* Build the opening and closing list item tags
*/
$ls = sprintf("\n\t\t<li class=\"%s\">", $class);
$le = "\n\t\t</li>";
/**
*Add the day of the month to identify the calendar box
*/
if ($i>$this->_startDay && $this->_daysInMonth>=$c)
{
/*
* Format events data
*/
$event_info = NULL;
if ( isset($events[$c]) )
{
foreach ( $events[$c] as $event )
{
$link = '<a href="view.php?event_id='
. $event->id . '">' . $event->title
. '</a>';
$event_info .= "\n\t\t\t$link";
}
}
$date = sprintf("\n\t\t\t<strong>%02d</strong>",$c++);
}
else { $date=" "; }
/**
*IF the current day is saturday, wrap to the next row
*/
$wrap = $i!=0 && $i%7==0?"\n\t</ul>\n\t<ul>":NULL;
/**
*Assemple the pieces into finished items
*/
$html .= $ls . $date . $event_info . $le . $wrap;
}[/php]
The problem is at some point $i is getting values from 3to32 in the loop where $event_info variable is,$c is getting 1-30 as it should be for the current month. I couldn’t find where $i is affected. Hope you can help me.TY.
P.S. The code is taken from the book “Pro php and jquery”