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.

General Questions

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

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

Director::BaseURL() in Template?


3 Posts   7428 Views


27 October 2009 at 2:29am Community Member, 509 Posts

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?




27 October 2009 at 3:25am Community Member, 509 Posts

Never mind, I found it: $BaseHref



13 January 2010 at 9:20am (Last edited: 13 January 2010 6:40pm), Community Member, 31 Posts

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]]