Are you in a TPL or a PHP file? It looks like you are trying to call PHP functions from TPL (Smarty). If that's the case, you need to do something like:
Source. You might have to code it to handle both HTTPS and HTTP and non-WWW with WWW in case those scenarios ever come up for you.