Community Documentation

base_path

5 common.inc base_path()
6 common.inc base_path()
7 common.inc base_path()
8 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:

  • http://example.com returns "/" because the path is empty.
  • http://example.com/drupal/folder returns "/drupal/folder/".

▾ 24 functions call 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.
FileURLRewritingTest::testShippedFileURL in modules/simpletest/tests/file.test
Test the generating of rewritten shipped file URLs.
file_icon_url in modules/file/file.module
Creates a URL to the icon for a file object.
file_test_file_url_alter in modules/simpletest/tests/file_test.module
Implements hook_file_url_alter().
install_check_requirements in includes/install.core.inc
Checks installation requirements and reports any errors.
JavaScriptTestCase::testAddFile in modules/simpletest/tests/common.test
Test adding a JavaScript file.
LocalePathFunctionalTest::testPathLanguageConfiguration in modules/locale/locale.test
Test if a language can be associated with a path alias.
LocaleUILanguageNegotiationTest::testUrlLanguageFallback in modules/locale/locale.test
Test URL language detection when the requested URL has no language.
LocaleUrlRewritingTest::checkUrl in modules/locale/locale.test
Check URL rewriting for the given language.
search_index in modules/search/search.module
Update the full-text search index for a particular item.
system_requirements in modules/system/system.install
Test and report Drupal installation requirements.
template_preprocess_maintenance_page in includes/theme.inc
The variables array generated here is a mirror of template_preprocess_page(). This preprocessor will run its course when theme_maintenance_page() is invoked.
template_preprocess_page in includes/theme.inc
Preprocess variables for page.tpl.php
update_authorize_update_batch_finished in modules/update/update.authorize.inc
Batch callback for when the authorized update batch is finished.
update_helpful_links in ./update.php
update_info_page in ./update.php
update_results_page in ./update.php
url in includes/common.inc
Generates an internal or external URL.
UrlAlterFunctionalTest::assertUrlOutboundAlter in modules/simpletest/tests/path.test
Assert that an outbound path is altered to an expected value.
_color_rewrite_stylesheet in modules/color/color.module
Rewrites the stylesheet to match the colors in the palette.

File

includes/common.inc, line 2724
Common functions that many Drupal modules will need to reference.

Code

<?php
function base_path() {
  return $GLOBALS['base_path'];
}
?>
Login or register to post comments