Get the site base url in template.php
You can use the base_path() function which should always work.

To be honest though it just returns $GLOBALS['base_path'] so your global $base_path statement should work fine.