We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

KyleLee on 11/24/07


Tagged

drupal


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

basicmagic
heinz1959
panatlantica


Drupal Index


Published in: PHP 


This is the whole index file of drupal. The design & structure are very clear. First, like an operation system, drupal has a boot. The param of drupal_bootstrap describes a phase of Drupal to load. the boot load the global configs, initialize cache, initialize db layer, identify and reject banned hosts, initialize session handling and validate and fix input data.

Second, the function menuexecuteactive_handler(path) execute the page callback associated with the current path.

Finally, display the page you want.

  1. <?php
  2. // $Id: index.php,v 1.93 2007/04/06 13:27:20 dries Exp $
  3.  
  4. /**
  5.  * @file
  6.  * The PHP page that serves all page requests on a Drupal installation.
  7.  *
  8.  * The routines here dispatch control to the appropriate handler, which then
  9.  * prints the appropriate page.
  10.  */
  11.  
  12. require_once './includes/bootstrap.inc';
  13. drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
  14.  
  15. $return = menu_execute_active_handler();
  16.  
  17. // Menu status constants are integers; page content is a string.
  18. if (is_int($return)) {
  19. switch ($return) {
  20. case MENU_NOT_FOUND:
  21. drupal_not_found();
  22. break;
  23. case MENU_ACCESS_DENIED:
  24. drupal_access_denied();
  25. break;
  26. case MENU_SITE_OFFLINE:
  27. drupal_site_offline();
  28. break;
  29. }
  30. }
  31. elseif (isset($return)) {
  32. // Print any value (including an empty string) except NULL or undefined:
  33. print theme('page', $return);
  34. }
  35.  
  36. drupal_page_footer();
  37. ?>

Report this snippet 

You need to login to post a comment.