Information Technology Reference
In-Depth Information
Figure 4-8.
A neatly organized mock folder structure as seen in the file browser of Adobe Dreamweaver CS5.5
Here we are sticking with a very basic structure in which all of the resource directories
(such as our css , img , and js folders) are in the Document Root folder of the site, and
there is a template folder which will hold the template code for the different pages of our
web application.
Inside of the template folder there is an includes folder which we will use to house
documents that are used throughout the application, such as markup code for the
header or footer, and maybe even some random blocks of content. Referring to our
example in the previous section on relative paths, the include line in our index.php
file in Figure 4-8 would reference the footer file as include
('template/includes/footer.php') . This not only keeps things separated, it makes
logical sense as well. The footer is part of the template, and it's included in pretty much
everything, hence it lives in the includes directory, within the template directory.
Now when it comes time to develop our application or make an update in the future we
won't have to try and remember where all of our code is located because we can easily
and logically find it at a glance.
If we want to edit the information on the contact page we will just edit the template file
located at /template/contact.php . If we see a problem with the header file we can easily
jump into /template/includes/header.php and make any changes we need to our
hearts' content, and then have those changes reflected throughout the entire
application.
Summary
Hopefully now that you reached the end of yet another chapter you have a better idea of
what kind of thought process and work goes into the creation of a web application, or
 
Search WWH ::




Custom Search