In the preceding section, we introduced the technologies that drive Drupal.
However, how do they all fit together? In this section, we provide an overview
of Drupal’s architecture.
Let’s begin with a visual representation. The following diagram sketches Drupal’s
The preceding figure represents, in a roughshod way, how Drupal is structured. It
also indicates how Drupal handles a request. We will talk about the components
in the remainder of this section. As a first approach, though, let’s walk through a
simplified example of a typical request as it is handled on a Drupal website:
- A user enters the URL http://example.com/node/123 in a web browserand hits Enter
- The browser contacts the web server atexample.com and requests theresource at /node/123
- The web server recognizes that the request must be handled by PHP, and starts up (or contacts) a PHP environment to handle the request
- PHP executes Drupal’sindex.php file, handing it the path /node/123
- The Drupal core undergoes a bootstrap process, initializing resources, and then uses the menu system to find out how to handle /node/123
- The node system responds to the request for /node/123 by loading the node (piece of content) with the ID123. This data is typically loaded from a database
- The theme system takes the node information and applies formatting and style information to it, essentially transforming data into chunks of HTML with associated CSS
- The Drupal core completes all processing (giving many other subsystems the opportunity to handle various bits of data processing) and then returns the data to the client
- The user views the document
While this illustration hasn’t hit every technical detail, it does provide a glimpse
into the way Drupal functions on the web. In the following section, we will spend
some time looking at the big Drupal subsystems—nodes, themes, menus, and so on.
However, in the present section, we are more concerned with the general way in
which these systems work together.
Earlier, we saw that under normal conditions, PHP loads Drupal’s
index.php file to
handle a Drupal request. This short script is responsible for starting up the Drupal
environment, and it is part of what we typically call the Drupal core.