5.9. Architecture
In this section, we discuss a few ways to organize the code in your web application. Although we cannot present you with every possible way of organizing code, we can at least discuss some of the most common ways.
5.9.1. One Script Serves All
One script serves all stands for the idea that one script, usually index.php, handles all the requests for all different pages. Different content is passed as parameters to the index.php script by adding URL parameters such as ?page=register. It is not wise to store all code in the index.php script itself, but you can include the required code into the script. Figure 5.4 shows how it might work.
Figure 5.4. The “one script serves all” approach.
As you can see, there ...
Get PHP 5 Power Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.