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

Get link of home page


Go to End


3 Posts   1971 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!