Skip to content

Instantly share code, notes, and snippets.

@klan
Created July 21, 2013 16:33
Show Gist options
  • Save klan/6049066 to your computer and use it in GitHub Desktop.
Save klan/6049066 to your computer and use it in GitHub Desktop.
Drupal bootstrap
<?php
// Get path of drupal install and strip path to module
$drupal_path = preg_replace('@\/sites\/[a-zA-Z_/]+@i', '', getcwd());
// Create a constant DRUPAL_ROOT that defines our path to the drupal install
define('DRUPAL_ROOT', $drupal_path);
// require bootstrap
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
// bootstrap full
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment