Addition to Scott Reinen's answer:
In the page.tpl.php template, it is also available in the $base_path variable.
In many cases, you donโt even need to know the base path, because the Drupal API functions add it themselves. For example, to print a link, you can do this:
<?php print '<a href="' . base_path() . 'foo/bar">Foo Bar</a>'; ?>
But the โDrupal wayโ for this is to use the l () function:
<?php print l('Foo Bar', 'foo/bar'); ?>
The l () function will automatically add the base path to href.
marcvangend
source share