02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

150<br />

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

}<br />

}<br />

$le = "\n\t\t";<br />

/*<br />

* Add the day of the month to identify the calendar box<br />

*/<br />

if ( $this->_startDay_daysInMonth>=$c)<br />

{<br />

$date = sprintf("\n\t\t\t%02d",$c++);<br />

}<br />

else { $date="&nbsp;"; }<br />

/*<br />

* If the current day is a Saturday, wrap to the next row<br />

*/<br />

$wrap = $i!=0 && $i%7==0 ? "\n\t\n\t" : NULL;<br />

/*<br />

* Assemble the pieces into a finished item<br />

*/<br />

$html .= $ls . $date . $le . $wrap;<br />

/*<br />

* Add filler to finish out the last week<br />

*/<br />

while ( $i%7!=1 )<br />

{<br />

$html .= "\n\t\t&nbsp;";<br />

++$i;<br />

}<br />

/*<br />

* Close the final unordered list<br />

*/<br />

$html .= "\n\t\n\n";<br />

/*<br />

* Return the markup for output<br />

*/<br />

return $html;<br />

Test the function as it st<strong>and</strong>s now, <strong>and</strong> you’ll see the unordered lists in your browser (see<br />

Figure 4-5).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!