Prev | Current Page 3 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

It contains a rich set of reusable components containing everything from a set of
Model-View-Controller application components to PDF generation. Over the course of this book, we will look
at how to use all the components within the context of a real website.
1.1 Introducing structure to PHP websites
The solution to this tangled mess of PHP code and HTML on a website is structure. The most obvious
introduction to structured applications within PHP sites is applying the concept of ???separation of concerns???.
This means that the code that does the display should not be in the same file as the code that connects to the
database and collects the data as shown in Figure 1.1.
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
Figure 1.1: The organization of a typical PHP file created by a novice interleaves HTML and PHP code in a linear fashion as the file is
created.
The first stages of introducing structure to a website??™s code happen by default for most developers; the
concept of reusability dawns. Generally, this means that the code that connects to the database is separated into
a file called something like db.inc.php. Then it seems logical to separate out the code that displays the common
header and footer elements on every page.


Pages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
kasta.brene.pl Wczasy nad morzem Prince lion przeszycia łódź tłumacz niemieckiego