| 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 calls to base_path()
2 string references to 'base_path'
File
- includes/
common.inc, line 2726 - Common functions that many Drupal modules will need to reference.
Code
function base_path() {
return $GLOBALS['base_path'];
}
Login or register to post comments
Comments
This function is for URLs.
This function is for URLs. Are you looking for the path to the Drupal installation on the server's filesystem? Try the
DRUPAL_ROOTconstant. (Note that, unlike what's returned by this function, there won't be a / at the end of that path.)