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.

}<br />

?><br />

}<br />

}<br />

}<br />

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

■ Note The preceding function uses constants that are not defined just yet. You’ll create the files to define these<br />

constants in the next section.<br />

Creating the Class Wrapper<br />

To build the application itself, start <strong>by</strong> creating the file class.calendar.inc.php in the class folder that<br />

resides within the non-public sys folder (/sys/class/class.calendar.inc.php). This class will extend the<br />

DB_Connect class in order to have access to the database object. Open the file in your editor of choice <strong>and</strong><br />

create the Calendar class using the following code:<br />

<br />

With the class created, you can start adding the properties <strong>and</strong> methods to the class.<br />

Adding Class <strong>Pro</strong>perties<br />

The Calendar class doesn’t need any public properties, <strong>and</strong> you won’t be extending it in the examples<br />

contained within this book, so all class properties will be private.<br />

127

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

Saved successfully!

Ooh no, something went wrong!