读书笔记:Drupal 7 module development
Reading notes on book Drupal 7 module development.
- a normal request flow looks like the following:
- user enter url: http://example.com/node/123
- browser contacts web server at address example.com and requests the resource at node/123
- web server recognize that the request has to be handled by PHP, and then set up a PHP environment.
- how does web server understand the request needs to be handled by PHP?
- PHP handler (I guess) executes index.php in drupal, handling the path node/123 for parsing
- Drupal core undergoes a boostrap process, initializing all resources and use menu system to find out how handle node/123
- node system responds to the request for node/123 by loading node content with id 123.
- how does the system handle the request over to node system? by name?
- Theme system kicks in, taking node information and applies formatting/styling information to it, essentially transforming chunk of node information into hmtl and css code
- Drupal core completes all processing, then the subsystem could step in and handle some processing if any.
- output is returned to client and parsed by client browser.
- Drupal has a set of libraries loaded in the bootstrap proces, like interacting with db, translating between languages, they facilite effective data processing, but not responsible for handling the lifecycle of a request (module does).
- Both modules and themes can manipulate the look and fee of data, generally, modules can provide the default look, and theme can selectively override those themes.
- Put custom modules in /sites/default/modules, this is the best practice for drupal development.
浙公网安备 33010602011771号