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.

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

• index.php: This is the main file, which displays the month in calendar format with<br />

event titles displayed in the box of the day on which they occur.<br />

• view.php: If users clicks an event title, they’re taken to this page where the event’s<br />

data is displayed in detail.<br />

• admin.php: To create or modify new events, the form displayed on this page is<br />

used.<br />

• confirmdelete.php: To delete an event, the user must first confirm that choice <strong>by</strong><br />

submitting the confirmation form on this page.<br />

The public folder will also have a subfolder called assets, which will contain additional files for the<br />

site. Those files will be grouped <strong>by</strong> their usage, which in this section falls into four categories: common<br />

files, CSS files, JavaScript files, <strong>and</strong> form-processing files.<br />

Create four folders within assets called common, css, inc, <strong>and</strong> js. The common folder will store files that<br />

will be used on all the publicly accessible pages (namely the header <strong>and</strong> footer of the app); the css folder<br />

will store site style sheets; the inc folder will store files to process form-submitted input; <strong>and</strong> the js<br />

folder will store site JavaScript files.<br />

Nonpublic Application Files<br />

The sys folder will be broken into three subfolders: class, which will store all class files for the<br />

application (such as the Calendar class); config, which stores application configuration information<br />

such as database credentials; <strong>and</strong> core, which holds the files that initialize the application.<br />

When everything is organized <strong>and</strong> all files are created, the file structure will be well organized <strong>and</strong><br />

easy to scale in the future (see Figure 4-1).<br />

Figure 4-1. The folder structure <strong>and</strong> files as they appear in NetBeans 6.8 on Mac<br />

121

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

Saved successfully!

Ooh no, something went wrong!