O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required