function base_path

Same name in other branches
  1. 9 core/includes/common.inc \base_path()
  2. 8.9.x core/includes/common.inc \base_path()
  3. 10 core/includes/common.inc \base_path()
  4. 11.x core/includes/common.inc \base_path()

Returns the base URL path (i.e., directory) of the Drupal installation.

base_path() adds a "/" to the beginning and end of the returned path if the path is not empty. At the very least, this will return "/".

Examples:

25 calls to base_path()
AJAXFrameworkTestCase::testAJAXRender in modules/simpletest/tests/ajax.test
Test that ajax_render() returns JavaScript settings generated during the page request.
color_scheme_form_submit in modules/color/color.module
Form submission handler for color_scheme_form().
CommonURLUnitTest::testUrl in modules/simpletest/tests/common.test
Test url() with/without query, with/without fragment, absolute on/off and assert all that works when clean URLs are on and off.
drupal_add_js in includes/common.inc
Adds a JavaScript file, setting, or inline code to the page.
FileURLRewritingTest::testPublicCreatedFileURL in modules/simpletest/tests/file.test
Test the generating of rewritten public created file URLs.

... See full list

File

includes/common.inc, line 2983

Code

function base_path() {
    return $GLOBALS['base_path'];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.