Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling Drupal functions in external PHP file

How can I call a Drupal function or get the global variable in a PHP file which is located under the drupal installation folder. I doing it for the first time. Are there any files I need to include in my code in order to access the Drupal function or variables?

like image 254
Dijo David Avatar asked Jun 29 '11 08:06

Dijo David


1 Answers

If the above explained example doesn't work try this:

$path = $_SERVER['DOCUMENT_ROOT'];
chdir($path."/drupal");
define('DRUPAL_ROOT', getcwd()); //the most important line
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
like image 197
Alexey Avatar answered Oct 04 '22 04:10

Alexey