Information Technology Reference
In-Depth Information
Now the cool thing about PHP is that it runs on the server, not on the client side. That
means that none of the PHP code you include in your HTML document (whether this
means including other documents into your template, or custom created classes,
functions, etc.) will ever be visible to the client. What the client will see when he or she
loads the page and views the source is just one seamless HTML document (see
Listing 4-3).
Listing 4-3. Viewing Our Faux Article In a Browser Would Show One Complete HTML Document, With No Server
Side PHP Code
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Super Cool Web Application</title>
</head>
<body>
<header>Super Awesome Header</header>
<article>
<header>Article Header</header>
<p>Fusce luctus accumsan odio. Cras vel sodales mi. Suspendisse et arcu quis magna
feugiat ultrices sit amet non erat. Etiam malesuada dui venenatis eros gravida aliquet.
Aliquam erat volutpat. Nullam dapibus cursus ultricies. Suspendisse congue accumsan
purus non scelerisque. Phasellus ut sapien libero, vel luctus velit.</p>
</article>
<!-- This is where we use PHP to include another file into our document -->
<footer>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Privacy Policy</a></li>
<li><a href="#">Terms and Conditions</a></li>
</ul>
<p>&copy; 2011 Super Awesome Site, Inc. All rights reserved.</p>
</footer>
</body>
</html>
Folder Structure
In the previous example we discussed segmenting your files into small structures to
make them more manageable. With more files, you'll probably also want to create
directories to store specific files grouped by function.
In Figure 4-8, I created a mock folder structure for a make-believe application. Just like
separating your code in your documents, it is also good practice to neatly arrange your
folder structure in such a way that you can easily find the files you need throughout the
development life of your app.
 
Search WWH ::




Custom Search