Only adding base_url to templates if SERVER_NAME is defined.

If this class is called from the command line (or a phpunit test, for example) the server_name is undefined and breaks things.