Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Director::BaseURL() in Template?

Go to End

4 Posts   16070 Views


Community Member, 541 Posts

27 October 2009 at 2:29am

Hey all,

Anyone know id there is a template tag to retrieve Director::BaseURL() from a template? I can create a method like:

public function getBaseUrl() {
    return Director::BaseURL();

But I was wondering if maybe there is something I can already use and not create duplicate code?




Community Member, 541 Posts

27 October 2009 at 3:25am

Never mind, I found it: $BaseHref



Community Member, 31 Posts

13 January 2010 at 9:20am

Edited: 13/01/2010 6:40pm

Just an addition... if you're wanting to get the page's full URL inside a template for something like a Digg link.. you can do the following


Hope this helps others.

[[Edited by Admin]]


Community Member, 9 Posts

11 May 2016 at 10:45pm

In SilverStripe 3.0 $BaseHref has been deprecated: you should now use $baseURL.