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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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

Get link of home page


Go to End


3 Posts   2224 Views

Avatar
DeklinKelly

Community Member, 197 Posts

3 February 2011 at 4:15am

Edited: 03/02/2011 4:15am

What is the best way to get the full path to the home page?

This only works if the ID of the home page is 1:

$HomeLink = DataObject::get_by_id("SiteTree", 1)->Link();

But if I make a different page the home page it does not work.

Avatar
baba-papa

Community Member, 279 Posts

3 February 2011 at 9:19am

$HomeLink = Director::absoluteBaseURL();

Avatar
DeklinKelly

Community Member, 197 Posts

3 February 2011 at 10:44am

Thanks!