Original post: http://developer.ctrlplusv.com/2010/04/12/drupal-6-base_path-is-not-base_path/

Over the past 2 days i close to finished the theme conversion for CGX24.

I now started to build some block modules and came across that $base_path does NOT (always ?) point to the home URL.

In my themplate i sticked to call the base url via

base_path()

By a typo i hoverver used

$base_path

on one of my modules to get the base URL, but i quickly figured that $base_path points out the full URL to current page.

After i had a closer look on the api docs, i defined $base_path as a global first, and this brought the correct result of $base_path being then the base URL.

However, the best solution in my mind is to always use base_path() if you need to get the base URL to your drupal install.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
Categories
Archives