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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

130<br />

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

}<br />

?><br />

* @param object $dbo a database object<br />

* @param string $useDate the date to use to build the calendar<br />

* @return void<br />

*/<br />

public function __construct($dbo=NULL, $useDate=NULL)<br />

{<br />

}<br />

The constructor will accept two optional parameters: the first is a database object, <strong>and</strong> the second is<br />

the date around which the calendar display should be built.<br />

Checking the Database Connection<br />

To function properly, the class needs a database connection. The constructor will call the parent<br />

constructor from DB_Connect to check for an existing database object <strong>and</strong> use that when available, or it<br />

will create a new object if none is supplied.<br />

Set up the call to make this check using the code shown in bold:<br />

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

Saved successfully!

Ooh no, something went wrong!