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.

136<br />

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

}<br />

?><br />

Now all the properties that were previously NULL will have values when you reload<br />

http://localhost/:<br />

object(Calendar)#2 (6) {<br />

}<br />

["_useDate:private"]=><br />

string(19) "2010-01-01 12:00:00"<br />

["_m:private"]=><br />

string(2) "01"<br />

["_y:private"]=><br />

string(4) "2010"<br />

["_daysInMonth:private"]=><br />

int(31)<br />

["_startDay:private"]=><br />

string(1) "5"<br />

["db:protected"]=><br />

object(PDO)#3 (0) {<br />

}<br />

Loading Events Data<br />

To load data about events, you need to create a new method to access the database <strong>and</strong> retrieve them.<br />

Because event data will be accessed in two ways (the second of which will be addressed later in this<br />

chapter), the act of loading data will be kept generic for easy reuse.<br />

This method will be private <strong>and</strong> named _loadEventData(). It accepts one optional parameter—the<br />

ID of an event—<strong>and</strong> follows these steps to load events:

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

Saved successfully!

Ooh no, something went wrong!