Drupal5: click on the menu, render a page — how it happens

The process below basically covers it, thought there are other mildly related and incidental things happening along the way.  The steps are given below are in the order they actually happen in the code.  Looking at this process in this way, it seems so simple…

  1. You click on a menu link (or any link, really) in Drupal5
  2. The web server receives your request and it is procesed in /index.php
    1. Some configuration bootstrapping occurs. (drupal_bootstrap)
    2. The system-set front page is returned if there’s no path on the URI. (drupal_get_normal_path, drupal_init_path)
    3. The database is consulted for the first URL alias it can find from the given path. (drupal_lookup_path) This is why Drupal utterly fails to handle multiple URL alias from a single source path!
    4. Custom URL rewrites are performed.
    5. The resulting URL is placed into $_GET['q']
  3. The menu system is then consulted for the proper callback for the derived path
    1. The derived path is used as a key for the menu system hash to find the call back (menu_execute_active_handler)
    2. If a callback is not found, a 404 is issued.
    3. If the user does not have access to menu item, a 403 is issued.
    4. If all is good, the callback is executed and its output presented

Leave a Reply